Update labels when user responds in issue and pr #21
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: Update labels when user responds in issue and pr | |
permissions: | |
issues: write | |
pull-requests: write | |
on: | |
issue_comment: | |
types: [created] | |
pull_request_review_comment: | |
types: [created] | |
jobs: | |
issue_commented: | |
if: github.event.issue && !github.event.issue.pull_request && github.event.comment.user.login == github.event.issue.user.login && contains(github.event.issue.labels.*.name, 'wait for update') && !contains(github.event.issue.labels.*.name, 'user responded') | |
runs-on: ubuntu-latest | |
steps: | |
- name: update labels when user responds | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
github.rest.issues.addLabels({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
labels: ["user responded"] | |
}) | |
github.rest.issues.removeLabel({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
name: "wait for update" | |
}) | |
pr_commented: | |
if: github.event.issue && github.event.issue.pull_request && github.event.comment.user.login == github.event.issue.user.login && github.event.issue.labels && !contains(github.event.issue.labels.*.name, 'user responded') | |
runs-on: ubuntu-latest | |
steps: | |
- name: update label when user responds | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
github.rest.issues.addLabels({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
labels: ["user responded"] | |
}) | |
pr_review_commented: | |
if: github.event.pull_request && github.event.comment.user.login == github.event.pull_request.user.login && github.event.pull_request.labels && !contains(github.event.pull_request.labels.*.name, 'user responded') | |
runs-on: ubuntu-latest | |
steps: | |
- name: update label when user responds | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
github.rest.issues.addLabels({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
labels: ["user responded"] | |
}) |