Update package.json #85
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: Issue Comments (Created). | |
on: | |
issue_comment: | |
types: [created] | |
jobs: | |
remove-label: | |
name: Remove labels used for tracking issues that a contributor is awaiting a response. | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/github-script@v3 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
console.log(JSON.stringify({ | |
labels: context.payload.issue.labels, | |
login: context.payload.sender.login | |
})); | |
if(context.payload.sender.login === 'neverendingqs') { | |
// Do not remove labels if a contributor wrote the comment | |
return; | |
} | |
const labels = [ | |
'awaiting response' | |
]; | |
labels.forEach(label => { | |
const hasLabel = context.payload.issue.labels | |
.map(({ name }) => name) | |
.includes(label); | |
if(hasLabel) { | |
github.issues.removeLabel({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: context.issue.number, | |
name: label, | |
}); | |
} | |
}); | |