Skip to content

Commit

Permalink
Update self-assign.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
MohanRamSridhar authored May 21, 2024
1 parent 598ea88 commit 636f91d
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions .github/workflows/self-assign.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,27 @@ on:
issue_comment:
types: [created]

permissions:
issues: write # Ensure the workflow has write permissions for issues

jobs:
assign:
runs-on: ubuntu-latest

steps:
- name: Assign issue to commenter if they comment "self"
if: github.event.comment.body == 'self'
uses: actions/github-script@v6
with:
script: |
const issueNumber = context.issue.number;
const commentBody = context.payload.comment.body.trim().toLowerCase();
const commenter = context.payload.comment.user.login;
await github.issues.addAssignees({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issueNumber,
assignees: [commenter]
});
if (commentBody === 'self') {
await github.rest.issues.addAssignees({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issueNumber,
assignees: [commenter]
});
}

0 comments on commit 636f91d

Please sign in to comment.