|
| 1 | +#/ |
| 2 | +# @license Apache-2.0 |
| 3 | +# |
| 4 | +# Copyright (c) 2024 The Stdlib Authors. |
| 5 | +# |
| 6 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | +# you may not use this file except in compliance with the License. |
| 8 | +# You may obtain a copy of the License at |
| 9 | +# |
| 10 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | +# |
| 12 | +# Unless required by applicable law or agreed to in writing, software |
| 13 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | +# See the License for the specific language governing permissions and |
| 16 | +# limitations under the License. |
| 17 | +#/ |
| 18 | + |
| 19 | +# Workflow name: |
| 20 | +name: labeler_needs_changes |
| 21 | + |
| 22 | +# Workflow triggers: |
| 23 | +on: |
| 24 | + pull_request_review: |
| 25 | + types: [submitted] |
| 26 | + |
| 27 | +# Workflow jobs: |
| 28 | +jobs: |
| 29 | + |
| 30 | + # Define a job which automatically labels pull requests as needing changes when a reviewer requests changes: |
| 31 | + add-needs-changes-label: |
| 32 | + |
| 33 | + # Define job name: |
| 34 | + name: 'Add "Needs Changes" Label when Reviewer Requests Changes' |
| 35 | + |
| 36 | + # Only run this job if the reviewer requested changes: |
| 37 | + if: ${{ github.event.review.state == 'changes_requested' }} |
| 38 | + |
| 39 | + # Define job permissions: |
| 40 | + permissions: |
| 41 | + contents: read |
| 42 | + pull-requests: write |
| 43 | + |
| 44 | + # Define the type of virtual host machine: |
| 45 | + runs-on: ubuntu-latest |
| 46 | + |
| 47 | + # Define the sequence of job steps: |
| 48 | + steps: |
| 49 | + |
| 50 | + # Add "Needs Changes" label: |
| 51 | + - name: 'Add "Needs Changes" label' |
| 52 | + # Pin action to a known commit SHA for reproducibility: |
| 53 | + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 |
| 54 | + with: |
| 55 | + github-token: ${{ secrets.CHATBOT_GITHUB_TOKEN }} |
| 56 | + script: | |
| 57 | + await github.rest.issues.addLabels({ |
| 58 | + 'owner': context.repo.owner, |
| 59 | + 'repo': context.repo.repo, |
| 60 | + 'issue_number': context.payload.pull_request.number, |
| 61 | + 'labels': [ 'Needs Changes' ] |
| 62 | + }) |
0 commit comments