From 50e39ecb17f0ce6848ec2e3bdfd492b842bce192 Mon Sep 17 00:00:00 2001 From: Alex Eagle Date: Wed, 3 Jul 2024 11:47:17 -0700 Subject: [PATCH 1/2] feat: provide stable-named job for branch protection GitHub actions matrix "test" gets expanded to many status checks, making it impossible to keep the branch protection settings in the GitHub UI up-to-date as the matrix cells are updated. This provides a "conclusion" status which can be used instead. Thanks @mattmoor for the code! --- .github/workflows/ci.yaml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index fedfc76..87d1eb7 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -29,3 +29,19 @@ jobs: [ {"folder": ".", "bzlmodEnabled": false} ] + # For branch protection settings, this job provides a "stable" name that can be used to gate PR merges + # on "all matrix jobs were successful". + conclusion: + needs: test + runs-on: ubuntu-latest + if: always() + steps: + - uses: technote-space/workflow-conclusion-action@45ce8e0eb155657ab8ccf346ade734257fd196a5 # v3.0.3 + + - if: ${{ env.WORKFLOW_CONCLUSION == 'success' }} + working-directory: /tmp + run: echo ${{ env.WORKFLOW_CONCLUSION }} && exit 0 + + - if: ${{ env.WORKFLOW_CONCLUSION == 'failure' }} + working-directory: /tmp + run: echo ${{ env.WORKFLOW_CONCLUSION }} && exit 1 From 42e7bef023809c9c8e1593e8df7e870d152f1b63 Mon Sep 17 00:00:00 2001 From: Alex Eagle Date: Fri, 19 Jul 2024 12:25:29 -0700 Subject: [PATCH 2/2] Update ci.yaml --- .github/workflows/ci.yaml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 87d1eb7..40b6b62 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -38,10 +38,14 @@ jobs: steps: - uses: technote-space/workflow-conclusion-action@45ce8e0eb155657ab8ccf346ade734257fd196a5 # v3.0.3 - - if: ${{ env.WORKFLOW_CONCLUSION == 'success' }} + # Note: possible conclusion values: + # https://github.com/technote-space/workflow-conclusion-action/blob/main/src/constant.ts + - name: report success + if: ${{ env.WORKFLOW_CONCLUSION == 'success' }} working-directory: /tmp run: echo ${{ env.WORKFLOW_CONCLUSION }} && exit 0 - - if: ${{ env.WORKFLOW_CONCLUSION == 'failure' }} + - name: report failure + if: ${{ env.WORKFLOW_CONCLUSION == 'failure' }} working-directory: /tmp run: echo ${{ env.WORKFLOW_CONCLUSION }} && exit 1