From 5fccf8e95f5650cee19c95d971b4d73a96a83d3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Jona=C5=A1?= Date: Wed, 6 Sep 2023 14:54:36 +0200 Subject: [PATCH] chore: ensure tests are properly running against broken main (#107) --- .github/workflows/integration-test-workflow.yml | 6 +++++- .github/workflows/test.yml | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integration-test-workflow.yml b/.github/workflows/integration-test-workflow.yml index c88ac20..2202cbb 100644 --- a/.github/workflows/integration-test-workflow.yml +++ b/.github/workflows/integration-test-workflow.yml @@ -55,7 +55,11 @@ jobs: - name: Verify default Push Workflow if: ${{ github.event_name != 'pull_request' }} run: | - BASE_SHA=$(echo $(git rev-parse HEAD~1)) + if git merge-base --is-ancestor $NX_BASE HEAD; then + BASE_SHA=$NX_BASE; + else + BASE_SHA=""; + fi 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.yml b/.github/workflows/test.yml index 1fe5d22..baf4166 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -68,7 +68,11 @@ jobs: if: github.event_name != 'pull_request' shell: bash run: | - BASE_SHA=$(echo $(git rev-parse HEAD~1)) + if git merge-base --is-ancestor $NX_BASE HEAD; then + BASE_SHA=$NX_BASE; + else + BASE_SHA=""; + fi 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!');}"