diff --git a/.github/workflows/integration-test-workflow.yml b/.github/workflows/integration-test-workflow.yml index 8740647..6ccccd9 100644 --- a/.github/workflows/integration-test-workflow.yml +++ b/.github/workflows/integration-test-workflow.yml @@ -45,3 +45,19 @@ jobs: uses: nrwl/nx-set-shas@v2 with: main-branch-name: ${{ inputs.main-branch-name }} + + - name: Verify default PR Workflow + if: ${{ github.event_name == 'pull_request' }} + run: | + BASE_SHA=$(echo $(git merge-base origin/${{github.base_ref}} HEAD)) + HEAD_SHA=$(git rev-parse HEAD) + node -e "if(process.env.NX_BASE == '${BASE_SHA}') console.log('Base set correctly'); else { throw new Error('Base not set correctly!');}" + node -e "if(process.env.NX_HEAD == '${HEAD_SHA}') console.log('Head set correctly'); else { throw new Error('Head not set correctly!');}" + + - name: Verify default Push Workflow + if: ${{ github.event_name != 'pull_request' }} + run: | + BASE_SHA=$(echo $(git rev-parse HEAD~1)) + HEAD_SHA=$(echo $(git rev-parse HEAD)) + node -e "if(process.env.NX_BASE == '${BASE_SHA}') console.log('Base set correctly'); else { throw new Error('Base not set correctly!');}" + node -e "if(process.env.NX_HEAD == '${HEAD_SHA}') console.log('Head set correctly'); else { throw new Error('Head not set correctly!');}" diff --git a/.github/workflows/test-integration.yml b/.github/workflows/test-integration.yml index fe7f0b0..602bf8b 100644 --- a/.github/workflows/test-integration.yml +++ b/.github/workflows/test-integration.yml @@ -21,6 +21,6 @@ jobs: fail-fast: false uses: ./.github/workflows/integration-test-workflow.yml with: - working-directory: ./integration-test + working-directory: integration-test main-branch-name: ${{ github.event_name == 'pull_request' && github.base_ref || github.ref_name }} runs-on: ${{ matrix.runs-on }}