summaryrefslogtreecommitdiff
path: root/.github/workflows/ubuntu.yml
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2023-10-14 21:09:08 -0700
committerTakashi Kokubun <takashikkbn@gmail.com>2023-10-14 22:24:24 -0700
commit222c4b85684424352d65125018d15a9e87d0a851 (patch)
tree6b1f9428929664f57637d3d014cdd074f0fddd2a /.github/workflows/ubuntu.yml
parent28bd3a96b9cf6830e94389d6288d0b6095de5993 (diff)
Add result job for required status checks
We've been using matrix jobs as required status checks. However, when [DOC] pull requests are created, the matrix content and templated variables are not executed, which results in changing the name of the matrix jobs. Then required status checks are considered missing because of the different names. So we can't merge [DOC] PRs right now. This `result` is a known technique to check the composite status of matrix jobs. https://github.com/orgs/community/discussions/26822 The `result` job is not only a non-matrix job, which doesn't have the above problem, but also an independent job that is not skipped by [DOC]. `needs` works even if all dependent jobs are skipped, so this trick works well. This is also useful when we want to change the content of matrix. When we change one, we usually have to update branches of old pull requests so that they get newly required jobs. However, with this method, only `result` jobs are required, so you don't need to update old pull requests. I still don't like the fact that now you cannot visualize which matrix jobs are "Required", but this seems like the best compromise.
Diffstat (limited to '.github/workflows/ubuntu.yml')
-rw-r--r--.github/workflows/ubuntu.yml8
1 files changed, 8 insertions, 0 deletions
diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml
index 661771c730..613a7a0847 100644
--- a/.github/workflows/ubuntu.yml
+++ b/.github/workflows/ubuntu.yml
@@ -117,6 +117,14 @@ jobs:
SLACK_WEBHOOK_URL: ${{ secrets.SIMPLER_ALERTS_URL }} # ruby-lang slack: ruby/simpler-alerts-bot
if: ${{ failure() }}
+ result:
+ if: ${{ always() }}
+ runs-on: ubuntu-latest
+ needs: [make]
+ steps:
+ - run: exit 1
+ if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}
+
defaults:
run:
working-directory: build