www.thegamesmachine.it #314485
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 when the issue is labeled with 'A: In progress'" | |
on: | |
issues: | |
types: [labeled] | |
jobs: | |
assign: | |
if: ${{ github.repository == 'AdguardTeam/AdguardFilters' }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/github-script@v7 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const labelName = context.payload.label.name; | |
const senderName = context.payload.sender.login; | |
const owner = context.repo.owner; | |
const repo = context.repo.repo; | |
const issueNumber = context.issue.number; | |
const assignees = context.payload.issue.assignees.map(a => a.login); | |
if (labelName === 'A: In progress' && !assignees.includes(senderName)) { | |
console.log(`Adding @${senderName} to the #${issueNumber} assignees`); | |
await github.rest.issues.addAssignees({ | |
owner, | |
repo, | |
issue_number: issueNumber, | |
assignees: [ senderName ], | |
}); | |
} |