Skip to content

Commit 08ed2b2

Browse files
authored
chore: label new issues with 'needs-triage' via GH Action (#1765)
<!-- .github/pull_request_template.md --> ## πŸ“Œ Description * Trigger on new issues. * Adds `needs-triage` label (error if the label does not exist) ## πŸ” Related Issues <!-- Link any related issues here --> ## πŸš€ Pull Request Checklist Thank you for contributing to FlashInfer! Before we review your pull request, please make sure the following items are complete. ### βœ… Pre-commit Checks - [x] I have installed `pre-commit` by running `pip install pre-commit` (or used your preferred method). - [x] I have installed the hooks with `pre-commit install`. - [x] I have run the hooks manually with `pre-commit run --all-files` and fixed any reported issues. > If you are unsure about how to set up `pre-commit`, see [the pre-commit documentation](https://pre-commit.com/). ## πŸ§ͺ Tests My plan for testing this is to merge and then create a test issue. Not a great solution, I know, but this is the best Cursor could come up with. :) - [ ] Tests have been added or updated as needed. - [ ] All tests are passing (`unittest`, etc.). ## Reviewer Notes <!-- Optional: anything you'd like reviewers to focus on, concerns, etc. -->
1 parent 1bb7259 commit 08ed2b2

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Triage new issues
2+
3+
on:
4+
issues:
5+
types: [opened]
6+
7+
permissions:
8+
issues: write
9+
10+
jobs:
11+
triage:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Add needs-triage label
15+
uses: actions/github-script@v7
16+
with:
17+
github-token: ${{ secrets.GITHUB_TOKEN }}
18+
script: |
19+
const issueNumber = context.issue.number;
20+
const { owner, repo } = context.repo;
21+
const labelName = 'needs-triage';
22+
try {
23+
await github.rest.repos.getLabel({ owner, repo, name: labelName });
24+
} catch (error) {
25+
if (error.status === 404) {
26+
throw new Error(`Required label '${labelName}' does not exist in ${owner}/${repo}. Please create it in the repository settings.`);
27+
}
28+
throw error;
29+
}
30+
await github.rest.issues.addLabels({
31+
owner,
32+
repo,
33+
issue_number: issueNumber,
34+
labels: [labelName],
35+
});

0 commit comments

Comments
Β (0)