Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/workflows/add-help-wanted.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Add Help Wanted or Good First Issue Labels

on:
issue_comment:
types: [created]

permissions:
issues: write

jobs:
label-on-comment:
if: github.event.comment.body == '/help-wanted' || github.event.comment.body == '/good-first-issue'
runs-on: ubuntu-latest
steps:
- name: Add label based on comment
uses: actions/github-script@v7
with:
script: |
const comment = context.payload.comment.body.trim().toLowerCase();
const issue_number = context.payload.issue.number;
const owner = context.repo.owner;
const repo = context.repo.repo;

let label = null;
if (comment === '/help-wanted') {
label = 'help wanted';
} else if (comment === '/good-first-issue') {
label = 'good first issue';
}

if (label) {
await github.rest.issues.addLabels({
owner,
repo,
issue_number,
labels: [label],
});
console.log(`Added label: ${label}`);
} else {
console.log('No matching label to apply.');
}