-
-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added the auto assign workflow yaml file
feat: added the auto assign workflow yaml file
- Loading branch information
Showing
2 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Auto-assign issue on /attempt comment | ||
|
||
on: | ||
issue_comment: | ||
types: [created] | ||
|
||
jobs: | ||
auto-assign: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/github-script@v7 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
const comment = context.payload.comment; | ||
const issue = context.issue; | ||
if (comment.body.startsWith('/attempt')) { | ||
if (!issue.assignee) { | ||
github.issues.assignees.add({ | ||
issue_number: issue.number, | ||
assignees: [comment.user.login] | ||
}); | ||
await github.issues.createComment({ | ||
issue_number: issue.number, | ||
body: 'Assigned the issue to you!' | ||
}); | ||
} else { | ||
await github.issues.createComment({ | ||
issue_number: issue.number, | ||
body: 'This issue is already assigned. Tag a maintainer if you need to take over.' | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters