|
1 | | -# Required PR gate verifying that a PR's conventional-commit declaration is consistent with its code and changelog entries; changelog drafting lives in changelog-command.yml. |
| 1 | +# Required source-PR gate verifying that a conventional-commit declaration is consistent with its code and changelog entries. |
| 2 | +# Mergify queue candidates skip these policy jobs because their generated metadata does not describe a source change. |
2 | 3 | name: PR Gate |
3 | 4 |
|
4 | 5 | on: |
@@ -32,23 +33,40 @@ jobs: |
32 | 33 | runs-on: ubuntu-latest |
33 | 34 | timeout-minutes: 5 |
34 | 35 | outputs: |
| 36 | + queue_candidate: ${{ steps.classify.outputs.queue_candidate || 'false' }} |
35 | 37 | semver: ${{ steps.filter.outputs.semver || 'true' }} |
36 | 38 | breaking: ${{ steps.title.outputs.breaking }} |
37 | 39 | type: ${{ steps.title.outputs.type }} |
38 | 40 | conventional: ${{ steps.title.outputs.conventional }} |
39 | 41 | steps: |
40 | | - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 42 | + - name: Identify Mergify queue candidates |
| 43 | + id: classify |
41 | 44 | if: github.event_name == 'pull_request' |
| 45 | + env: |
| 46 | + PR_AUTHOR: ${{ github.event.pull_request.user.login }} |
| 47 | + HEAD_REPOSITORY: ${{ github.event.pull_request.head.repo.full_name }} |
| 48 | + HEAD_REF: ${{ github.event.pull_request.head.ref }} |
| 49 | + REPOSITORY: ${{ github.repository }} |
| 50 | + run: | |
| 51 | + queue_candidate=false |
| 52 | + if [[ "$PR_AUTHOR" == "mergify[bot]" ]] && |
| 53 | + [[ "$HEAD_REPOSITORY" == "$REPOSITORY" ]] && |
| 54 | + [[ "$HEAD_REF" == mergify/merge-queue/* ]]; then |
| 55 | + queue_candidate=true |
| 56 | + fi |
| 57 | + echo "queue_candidate=$queue_candidate" >> "$GITHUB_OUTPUT" |
| 58 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 59 | + if: github.event_name == 'pull_request' && steps.classify.outputs.queue_candidate != 'true' |
42 | 60 | with: |
43 | 61 | persist-credentials: false |
44 | 62 | - uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1 |
45 | 63 | id: filter |
46 | | - if: github.event_name == 'pull_request' |
| 64 | + if: github.event_name == 'pull_request' && steps.classify.outputs.queue_candidate != 'true' |
47 | 65 | with: |
48 | 66 | filters: .github/path-filters.yml |
49 | 67 | - name: Read the declaration from the PR title |
50 | 68 | id: title |
51 | | - if: github.event_name == 'pull_request' |
| 69 | + if: github.event_name == 'pull_request' && steps.classify.outputs.queue_candidate != 'true' |
52 | 70 | env: |
53 | 71 | PR_TITLE: ${{ github.event.pull_request.title }} |
54 | 72 | run: | |
|
78 | 96 |
|
79 | 97 | semver-checks: |
80 | 98 | needs: changes |
81 | | - # Real work runs only on pull requests that change Rust and do not already declare a break |
82 | | - # with `!`. A declared break is allowed through; release-plz majors the version at release. |
83 | | - if: github.event_name == 'pull_request' && needs.changes.outputs.semver == 'true' && needs.changes.outputs.breaking == 'false' |
| 99 | + # Real work runs only on contributor pull requests that change Rust and do not already declare |
| 100 | + # a break with `!`. A declared break is allowed through; release-plz majors the version at release. |
| 101 | + if: >- |
| 102 | + github.event_name == 'pull_request' && |
| 103 | + needs.changes.outputs.queue_candidate != 'true' && |
| 104 | + needs.changes.outputs.semver == 'true' && |
| 105 | + needs.changes.outputs.breaking == 'false' |
84 | 106 | runs-on: ubuntu-latest |
85 | 107 | timeout-minutes: 45 |
86 | 108 | steps: |
@@ -109,7 +131,9 @@ jobs: |
109 | 131 |
|
110 | 132 | changelog-gate: |
111 | 133 | needs: changes |
112 | | - if: github.event_name == 'pull_request' |
| 134 | + if: >- |
| 135 | + github.event_name == 'pull_request' && |
| 136 | + needs.changes.outputs.queue_candidate != 'true' |
113 | 137 | runs-on: ubuntu-latest |
114 | 138 | timeout-minutes: 5 |
115 | 139 | steps: |
|
0 commit comments