Skip to content

Commit

Permalink
Create remove-labels.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
mechelon authored Oct 14, 2024
1 parent 2a38f63 commit 1e527c1
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/remove-labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: 'Remove labels'
on:
issue_comment:
types: [created]

jobs:
remove_label:
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- uses: actions/github-script@v7
with:
script: |
const issue_num = context.issue.number;
const owner = context.repo.owner;
const repo = context.repo.repo;
const issue = await github.rest.issues.get({
owner,
repo,
issue_number: issue_num
});
const labelsToRemove = ['needs more information', 'stale'];
for (const label of labelsToRemove) {
if (issue.data.labels.some(issueLabel => issueLabel.name === label)) {
await github.rest.issues.removeLabel({
issue_number: issue_num,
owner,
repo,
name: label
});
}
}

0 comments on commit 1e527c1

Please sign in to comment.