|
12 | 12 | # See the License for the specific language governing permissions and |
13 | 13 | # limitations under the License. |
14 | 14 |
|
15 | | -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
16 | | -# Label PRs with labels such as size. Note that this workflow is designed not to |
17 | | -# fail if labeling actions encounter errors; instead, it writes error messages |
18 | | -# as annotations on the workflow's run summary page. If labels don't seem to be |
19 | | -# getting applied, check the run summary page for errors. |
20 | | -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
21 | | - |
22 | | -name: Label pull requests |
| 15 | +name: Pull request labeler |
23 | 16 | run-name: >- |
24 | 17 | Label pull request ${{github.event.pull_request.number}} by ${{github.actor}} |
25 | 18 |
|
| 19 | +# This workflow is designed NOT to fail if labeling actions encounter errors; |
| 20 | +# instead, it notes errors as annotations on the workflow's run summary page. If |
| 21 | +# labels don't seem to be getting applied, check there for errors. |
| 22 | + |
26 | 23 | on: |
27 | 24 | # Note: do not copy-paste this workflow with `pull_request_target` left as-is. |
28 | 25 | # Its use here is a special case where security implications are understood. |
|
32 | 29 | - opened |
33 | 30 | - synchronize |
34 | 31 |
|
| 32 | + # Allow manual invocation. |
35 | 33 | workflow_dispatch: |
36 | 34 | inputs: |
37 | 35 | pr-number: |
38 | 36 | description: 'The PR number of the PR to label:' |
39 | 37 | type: string |
40 | 38 | required: true |
41 | 39 | debug: |
42 | | - description: 'Run with debugging turned on' |
| 40 | + description: 'Run with debugging options' |
43 | 41 | type: boolean |
44 | 42 | default: true |
45 | 43 |
|
| 44 | +# Declare default workflow permissions as read only. |
46 | 45 | permissions: read-all |
47 | 46 |
|
48 | 47 | jobs: |
|
56 | 55 | issues: write |
57 | 56 | pull-requests: write |
58 | 57 | env: |
| 58 | + # Environment variable PR_NUMBER is needed by size-labeler.sh. |
59 | 59 | PR_NUMBER: ${{inputs.pr-number || github.event.pull_request.number}} |
60 | | - # The next var is used by Bash. We add 'xtrace' to the options if this run |
61 | | - # is a workflow_dispatch invocation and the user set the 'trace' option. |
| 60 | + # Add xtrace to SHELLOPTS for all Bash scripts when doing debug runs. |
62 | 61 | SHELLOPTS: ${{inputs.debug && 'xtrace' || '' }} |
63 | 62 | steps: |
64 | 63 | - name: Check out a copy of the git repository |
|
68 | 67 | ./dev_tools/ci/size-labeler.sh |
69 | 68 |
|
70 | 69 | - name: Label the PR with a size label |
71 | | - id: label |
72 | 70 | continue-on-error: true |
73 | 71 | env: |
74 | 72 | GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} |
|
0 commit comments