Skip to content

Commit

Permalink
Merge pull request #74 from lakshay-saini-au8/fix/issue-auto-assign
Browse files Browse the repository at this point in the history
fix: issue auto assign cannot read properties of undefined assignees
  • Loading branch information
rajdip-b authored Jan 6, 2024
2 parents aaf6783 + 0ecc749 commit 9db9164
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions .github/workflows/auto-assign.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,27 @@ jobs:
script: |
const comment = context.payload.comment;
const issue = context.issue;
const owner = "keyshade-xyz";
const repo = "keyshade
if (comment.body.startsWith('/attempt')) {
if (!issue.assignee) {
github.issues.assignees.add({
await github.rest.issues.addAssignees({
owner,
repo,
issue_number: issue.number,
assignees: [comment.user.login]
});
await github.issues.createComment({
await github.rest.issues.createComment({
owner,
repo,
issue_number: issue.number,
body: 'Assigned the issue to you!'
});
} else {
await github.issues.createComment({
await github.rest.issues.createComment({
owner,
repo,
issue_number: issue.number,
body: 'This issue is already assigned. Tag a maintainer if you need to take over.'
});
Expand Down

0 comments on commit 9db9164

Please sign in to comment.