Skip to content

Commit

Permalink
fix(sage-monorepo): enable nx affected to compare HEAD to the offic…
Browse files Browse the repository at this point in the history
…ial main branch (Sage-Bionetworks#2538)
  • Loading branch information
tschaffter authored Feb 29, 2024
1 parent e4427df commit 45801a3
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ env:
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
DOCKER_USERNAME: ${{ github.actor }}
DOCKER_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
HEAD_REF: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref_name }}
HEAD_REPOSITORY: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name || github.repository }}

jobs:
push:
Expand All @@ -23,13 +25,15 @@ jobs:
# env:
# NX_BRANCH: main
steps:
- uses: actions/checkout@v3
name: Checkout [${{ github.ref_name }}]
- uses: actions/checkout@v4
name: Checkout ${{ env.HEAD_REPOSITORY }}:${{ env.HEAD_REF }}
with:
# We need to fetch all branches and commits so that Nx affected has a base to compare
# against.
fetch-depth: 0

- name: Derive appropriate SHAs for base and head for `nx affected` commands
uses: nrwl/nx-set-shas@v3
uses: nrwl/nx-set-shas@v4

- name: Set up the dev container
uses: ./.github/actions/setup-dev-container
Expand Down Expand Up @@ -82,15 +86,16 @@ jobs:
|| !startsWith(github.head_ref, 'renovate/')
)
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
name: Checkout merge commit
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
# We need to fetch all branches and commits so that Nx affected has a base to compare
# against.
fetch-depth: 0

- name: Derive appropriate SHAs for base and head for `nx affected` commands
uses: nrwl/nx-set-shas@v3

uses: nrwl/nx-set-shas@v4
- name: Set up the dev container
uses: ./.github/actions/setup-dev-container

Expand Down

0 comments on commit 45801a3

Please sign in to comment.