Skip to content

Commit 0d04fff

Browse files
authored
Update issue-response.yml
1 parent 7fbcf20 commit 0d04fff

File tree

1 file changed

+21
-13
lines changed

1 file changed

+21
-13
lines changed

.github/workflows/issue-response.yml

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,33 @@ jobs:
1111
add-sla-comment:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- name: Add Comment
14+
- name: Check if issue opener is an org member
15+
id: check_membership
16+
uses: actions/github-script@v6
17+
with:
18+
script: |
19+
const authorAssociation = context.payload.issue.author_association;
20+
console.log("Author association:", authorAssociation);
21+
22+
// Check if user is a MEMBER or OWNER
23+
const isMember = ['OWNER', 'MEMBER'].includes(authorAssociation);
24+
console.log("Is member:", isMember);
25+
return isMember;
26+
- name: Add SLA Comment if Not Org Member
27+
if: steps.check_membership.outputs.result == 'false'
1528
uses: actions/github-script@v6
1629
with:
1730
github-token: ${{ secrets.GITHUB_TOKEN }}
1831
script: |
19-
const issueNumber = context.issue.number;
20-
const owner = context.repo.owner;
21-
const repo = context.repo.repo;
22-
23-
// Get the username of the issue opener
24-
const username = context.payload.issue.user.login;
25-
26-
// Your markdown message
32+
const issue = context.payload.issue;
33+
const issueNumber = issue.number;
34+
const username = issue.user.login;
35+
2736
const slaMessage = `Hello @${username} 👋 Thank you for opening an issue in ACK! A maintainer will triage this issue soon.\n\nWe encourage community contributions, so if you're interested in tackling this yourself or suggesting a solution, please check out our [Contribution](https://github.com/aws-controllers-k8s/community/blob/main/CONTRIBUTING.md) and [Code of Conduct](https://github.com/aws-controllers-k8s/community/blob/main/CODE_OF_CONDUCT.md) guidelines.\n\nYou can find more information about ACK on our [website](https://aws-controllers-k8s.github.io/community/).`;
28-
29-
// Create the comment on the opened issue
37+
3038
await github.rest.issues.createComment({
31-
owner: owner,
32-
repo: repo,
39+
owner: context.repo.owner,
40+
repo: context.repo.repo,
3341
issue_number: issueNumber,
3442
body: slaMessage
3543
});

0 commit comments

Comments
 (0)