Skip to content

First Issue Labeler

First Issue Labeler #6

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']
});
}