Auto Assign and Thank Issues #7
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
name: Auto Assign, Thank, and Label Issues | |
on: | |
issues: | |
types: | |
- opened | |
jobs: | |
auto-assign: | |
runs-on: ubuntu-latest | |
permissions: | |
issues: write | |
steps: | |
- name: 'Thank, assign, and label the issue' | |
uses: actions/github-script@v7 # Latest version | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} # Use GitHub Token | |
script: | | |
const issueNumber = context.issue.number; | |
const issueCreator = context.payload.issue.user.login; | |
// Thank the issue creator | |
await github.rest.issues.createComment({ | |
issue_number: issueNumber, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: `Thanks @${issueCreator} for raising this issue! We'll look into it. Meanwhile, it's been assigned to you for further tracking.` | |
}); | |
// Assign the issue to the creator | |
await github.rest.issues.addAssignees({ | |
issue_number: issueNumber, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
assignees: [issueCreator] | |
}); | |
// Add the label "ggsoc-ext" to the issue | |
await github.rest.issues.addLabels({ | |
issue_number: issueNumber, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
labels: ['ggsoc-ext'] # Label to be added | |
}); |