-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #660 from ethanwhite/auto-remove-labels
Automatically remove waiting label after new comment
- Loading branch information
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Remove waiting labels after new comment | ||
on: | ||
issue_comment: | ||
types: [created] | ||
pull_request_review_comment: | ||
types: [created] | ||
|
||
permissions: | ||
issues: write # allow removing label from issue | ||
pull-requests: write # allow removing label from PR | ||
|
||
jobs: | ||
remove-label: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Remove label | ||
uses: actions/github-script@v5 | ||
with: | ||
script: | | ||
const issueNumber = context.issue.number || context.pull_request.number; | ||
const repo = context.repo; | ||
const labelToRemove = "Awaiting author contribution"; | ||
const { data: issueLabels } = await github.rest.issues.listLabelsOnIssue({ | ||
...repo, | ||
issue_number: issueNumber | ||
}); | ||
if (issueLabels.find(label => label.name === labelToRemove)) { | ||
await github.rest.issues.removeLabel({ | ||
...repo, | ||
issue_number: issueNumber, | ||
name: labelToRemove | ||
}); | ||
} |