ci: stop running the unit lane before tagging #264
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build | |
| on: [pull_request] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| jobs: | |
| # Skipped on a Release PR: it only bumps the version and rewrites the changelog. Not | |
| # keyed on github.actor, which is the pusher: clicking Update branch reattributes the | |
| # merge commit to whoever clicked, and the skip would stop firing on the normal release | |
| # path. The author and head repo clauses are what make it unforgeable; the branch name | |
| # on its own would let any PR call its branch release-please--x and skip the gate. | |
| unit: | |
| if: >- | |
| ${{ !(github.event.pull_request.user.login == 'github-actions[bot]' | |
| && github.event.pull_request.head.repo.full_name == github.repository | |
| && startsWith(github.head_ref, 'release-please--')) }} | |
| uses: ./.github/workflows/run_tests.yml | |
| # The one required status check on main. A matrix job skipped by `if:` publishes a | |
| # single check run with the template unexpanded, so per-leg contexts could never be | |
| # satisfied on a Release PR; this job carries no matrix for that reason. `skipped` is | |
| # accepted only when the condition above holds, repeated here because Actions cannot | |
| # share an expression. `!cancelled()` rather than `always()`: a cancelled run must stay | |
| # red, not report a pass. | |
| tests-passed: | |
| name: 🧪 Tests | |
| needs: unit | |
| if: ${{ !cancelled() }} | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - name: Check the unit lane | |
| env: | |
| RESULT: ${{ needs.unit.result }} | |
| RELEASE_PR: >- | |
| ${{ github.event.pull_request.user.login == 'github-actions[bot]' | |
| && github.event.pull_request.head.repo.full_name == github.repository | |
| && startsWith(github.head_ref, 'release-please--') }} | |
| run: | | |
| case "$RESULT" in | |
| success) | |
| echo "unit lane passed" | |
| ;; | |
| skipped) | |
| if [ "$RELEASE_PR" = "true" ]; then | |
| echo "release pr: unit lane skipped by design" | |
| else | |
| echo "::error::the unit lane was skipped on a PR that is not a Release PR" | |
| exit 1 | |
| fi | |
| ;; | |
| *) | |
| echo "::error::unit lane reported $RESULT" | |
| exit 1 | |
| ;; | |
| esac |