Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add pr label when user respond #5

Merged
merged 9 commits into from
Sep 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 36 additions & 4 deletions .github/workflows/update-labels.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
name: Update label when user responds
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:
run-check:
if: ${{ !github.event.issue.pull_request }} # don't execute for PR comments
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
if: ${{ 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') }}
with:
script: |
github.rest.issues.addLabels({
Expand All @@ -28,3 +30,33 @@ jobs:
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"]
})
Loading