Skip to content

Commit

Permalink
fix: issue auto assign cannot read properties of undefined assignees
Browse files Browse the repository at this point in the history
  • Loading branch information
Lakshay saini committed Jan 5, 2024
1 parent aaf6783 commit 0ecc749
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 0ecc749

Please sign in to comment.