-
Notifications
You must be signed in to change notification settings - Fork 27
33 lines (29 loc) · 1.03 KB
/
auto-label.yml
File metadata and controls
33 lines (29 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Auto-label new issues with your default labels!
# Set or add labels in the 'labels' list.
name: Auto Label New Issues
on:
issues:
types: [opened]
jobs:
label:
runs-on: ubuntu-latest
steps:
- name: Add labels
uses: actions/github-script@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
// Add or tweak your labels here
const labels = ["triage", "copilot"]; // <-- TUNE ME!
try {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
labels
});
console.log(`✅ Added labels [${labels.join(", ")}] to issue #${context.issue.number}`);
} catch (error) {
console.log(`⚠️ Failed to add labels: ${error.message}`);
console.log("Note: This may be due to insufficient permissions or invalid label names.");
}