From a9f7166c574f12d35830d1a8b41a693ed70556c1 Mon Sep 17 00:00:00 2001 From: Rory Abraham Date: Tue, 28 Jun 2022 12:53:23 -0700 Subject: [PATCH 1/3] Use a callable workflow for lint --- .github/workflows/lint.yml | 4 ++-- .github/workflows/preDeploy.yml | 11 ++++------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 78ab69af544b..05c2e2b441fb 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,14 +1,14 @@ name: Lint JavaScript on: - workflow_dispatch: + workflow_call: pull_request: types: [opened, synchronize] branches-ignore: [staging, production] jobs: lint: - if: ${{ github.actor != 'OSBotify' || github.event_name == 'workflow_dispatch' }} + if: ${{ github.actor != 'OSBotify' || github.event_name == 'workflow_call' }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/preDeploy.yml b/.github/workflows/preDeploy.yml index 266f998d4f03..bdfe605de7d8 100644 --- a/.github/workflows/preDeploy.yml +++ b/.github/workflows/preDeploy.yml @@ -5,17 +5,14 @@ on: branches: [main] jobs: + lint: + uses: ./.github/workflows/lint.yml + confirmPassingBuild: runs-on: ubuntu-latest + needs: lint steps: - - name: Run lint - id: lint - uses: Expensify/App/.github/actions/triggerWorkflowAndWait@main - with: - WORKFLOW: lint.yml - GITHUB_TOKEN: ${{ secrets.OS_BOTIFY_TOKEN }} - - name: Run tests id: tests uses: Expensify/App/.github/actions/triggerWorkflowAndWait@main From af5a5ddef2c699a33baf4b40902448344b471a14 Mon Sep 17 00:00:00 2001 From: Rory Abraham Date: Tue, 28 Jun 2022 13:08:14 -0700 Subject: [PATCH 2/3] Use workflow_call for test as well --- .github/workflows/preDeploy.yml | 12 ++++-------- .github/workflows/test.yml | 4 ++-- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/.github/workflows/preDeploy.yml b/.github/workflows/preDeploy.yml index bdfe605de7d8..151368d4b3eb 100644 --- a/.github/workflows/preDeploy.yml +++ b/.github/workflows/preDeploy.yml @@ -8,18 +8,14 @@ jobs: lint: uses: ./.github/workflows/lint.yml + test: + uses: ./.github/workflows/test.yml + confirmPassingBuild: runs-on: ubuntu-latest - needs: lint + needs: [lint, test] steps: - - name: Run tests - id: tests - uses: Expensify/App/.github/actions/triggerWorkflowAndWait@main - with: - WORKFLOW: test.yml - GITHUB_TOKEN: ${{ secrets.OS_BOTIFY_TOKEN }} - # This Slack step is duplicated in all workflows, if you make a change to this step, make sure to update all # the other workflows with the same change - uses: 8398a7/action-slack@v3 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c60b20a2257a..ea730c100996 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,14 +1,14 @@ name: Jest Unit Tests on: - workflow_dispatch: + workflow_call: pull_request: types: [opened, synchronize] branches-ignore: [staging, production] jobs: test: - if: ${{ github.actor != 'OSBotify' || github.event_name == 'workflow_dispatch' }} + if: ${{ github.actor != 'OSBotify' || github.event_name == 'workflow_call' }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 From 0705cca730169dd6c51d84c3c3f19e6efebe6940 Mon Sep 17 00:00:00 2001 From: Rory Abraham Date: Tue, 28 Jun 2022 13:09:40 -0700 Subject: [PATCH 3/3] Fix dependency for confirmPassingBuild --- .github/workflows/preDeploy.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/preDeploy.yml b/.github/workflows/preDeploy.yml index 151368d4b3eb..363c0f619b28 100644 --- a/.github/workflows/preDeploy.yml +++ b/.github/workflows/preDeploy.yml @@ -14,6 +14,7 @@ jobs: confirmPassingBuild: runs-on: ubuntu-latest needs: [lint, test] + if: ${{ always() && (needs.lint.result == 'failure' || needs.test.result == 'failure') }} steps: # This Slack step is duplicated in all workflows, if you make a change to this step, make sure to update all