Reassign reviewer command needs to exclude the PR author from the potential reviewers #19201
This file contains 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: Remove "waiting-response" label on issue comment | |
# To help with triage, if we're waiting for a response from a | |
# user we label the issue waiting-response. | |
# When a user comments on the issue the label is removed. | |
on: | |
issue_comment: | |
types: [created] | |
jobs: | |
remove_waiting_response: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 | |
env: | |
REMOVE_LABEL: "waiting-response" | |
with: | |
script: | | |
const { REMOVE_LABEL } = process.env | |
console.log(`Attempting to remove label "${REMOVE_LABEL}"`) | |
const { data } = await github.rest.issues.listLabelsOnIssue({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
}) | |
// Return early if there are no labels | |
if (data.length == 0){ | |
console.log(`Issue has no labels; not attempting to remove label "${REMOVE_LABEL}"`) | |
return | |
} | |
// Check if REMOVE_LABEL is present | |
const filteredData = data.filter(label => label.name == REMOVE_LABEL) | |
// Return early if filtering didn't identify the label as present | |
if (filteredData.length == 0){ | |
console.log(`Label "${REMOVE_LABEL}" not found on issue; not attempting to remove it.`) | |
return | |
} | |
console.log(`Label "${REMOVE_LABEL}" found! Now deleting it from the issue...`) | |
await github.rest.issues.removeLabel({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
name: REMOVE_LABEL | |
}) |