Feat: top creators #226
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: Assign Issue | |
on: | |
issue_comment: | |
types: [created] | |
jobs: | |
assign: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check if mention and label exist | |
id: check_mentions | |
uses: actions/github-script@v7 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const mentions = context.payload.comment.body.match(/@([a-zA-Z0-9_-]+)/g); | |
const label = context.payload.comment.body.match(/#([a-zA-Z0-9_-]+)/g); | |
return { mentions, label }; | |
- name: Assign to mentioned users | |
if: ${{ steps.check_mentions.outputs.mentions != null }} | |
uses: actions/github-script@v7 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const assignees = context.payload.comment.user.login; | |
await github.issues.addAssignees({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: context.payload.issue.number, | |
assignees: assignees | |
}); | |
- name: Add label if mentioned | |
if: ${{ steps.check_mentions.outputs.label != null }} | |
uses: actions/github-script@v7 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const label = context.payload.comment.body.match(/#([a-zA-Z0-9_-]+)/g)[0].replace('#',''); | |
await github.issues.addLabels({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: context.payload.issue.number, | |
labels: [label] | |
}); |