First Issue Labeler #4
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: First Issue Labeler | |
on: | |
issues: | |
types: [opened] | |
jobs: | |
first-issue: | |
runs-on: ubuntu-latest | |
permissions: | |
issues: write | |
steps: | |
- name: Check if first contribution | |
id: check | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const creator = context.payload.issue.user.login; | |
const issues = await github.rest.issues.listForRepo({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
creator: creator, | |
state: 'all' | |
}); | |
if (issues.data.length === 1) { | |
await github.rest.issues.addLabels({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: context.issue.number, | |
labels: ['good first issue'] | |
}); | |
} |