Skip to content

Commit

Permalink
feat: added the auto assign workflow yaml file
Browse files Browse the repository at this point in the history
  • Loading branch information
Lakshay saini committed Jan 3, 2024
1 parent 091e49b commit 5e1d0f1
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/auto-assign.yaml
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.'
});
}
}

0 comments on commit 5e1d0f1

Please sign in to comment.