Skip to content

Commit 146ba6d

Browse files
vishwaktsoberm
andauthored
fix(gh-workflow): skip issue comment labeling on pull requests (#7086)
`issue_comment` fires for pull requests as well as issues. The pending-maintainer-response step had no pull request guard, so every community comment on an open pull request tried to label it and failed with `Resource not accessible by integration (addLabelsToLabelable)`, the job only requests `issues: write`. Guard the job rather than granting `pull-requests: write`. These labels are issue triage state: they are applied by the `issues` events in label-new-issues.yml and removed by issue-closed.yml, neither of which fires for pull requests, so a labeled pull request would keep the label after being merged. Co-authored-by: Michael Sober <msober@amazon.com>
1 parent 39b6706 commit 146ba6d

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

.github/workflows/issue-comment.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ jobs:
1212
adjust_labels:
1313
runs-on: ubuntu-latest
1414

15+
# `issue_comment` fires for pull request comments as well. The triage labels
16+
# managed here are only applied to issues, and only cleaned up by the `issues`
17+
# events in label-new-issues.yml and issue-closed.yml, which never fire for
18+
# pull requests.
19+
if: ${{ !github.event.issue.pull_request }}
20+
1521
permissions:
1622
issues: write
1723

@@ -22,7 +28,7 @@ jobs:
2228

2329
steps:
2430
- name: Remove pending-community-response when new community comment received
25-
if: ${{ !contains(fromJSON('["MEMBER", "OWNER"]'), github.event.comment.author_association) && !github.event.issue.pull_request }}
31+
if: ${{ !contains(fromJSON('["MEMBER", "OWNER"]'), github.event.comment.author_association) }}
2632
shell: bash
2733
run: |
2834
gh issue edit $ISSUE_NUMBER --repo $REPOSITORY_NAME --remove-label "pending-community-response"

0 commit comments

Comments
 (0)