Skip to content

Commit

Permalink
Add GH action to automate removal of waiting label
Browse files Browse the repository at this point in the history
This action will automatically remove the "Awaiting author contribution" label when a new comment is made on an issue.
  • Loading branch information
ethanwhite committed May 11, 2024
1 parent 060a261 commit 3432904
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/automate-waiting-labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Remove waiting labels after new comment
# From https://github.com/weecology/DeepForest/blob/main/.github/workflows/automate-waiting-labels.yml

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
});
}

0 comments on commit 3432904

Please sign in to comment.