Skip to content

Commit 3697b39

Browse files
authored
fix: new issue workflow (#1773)
<!-- .github/pull_request_template.md --> ## 📌 Description The intent of the workflow is to add `needs-triage` when a new issue is created. The initial version of this workflow, added in #1765 failed when I created dummy issue #1772. This PR is a fix for that bug. ## 🔍 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 I have tested with `gh` CLI targeting my fork of this repo and also by adding the action to my fork. Completed action: https://github.com/sricketts/flashinfer/actions/runs/18041739971 - [x] 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 41a1926 commit 3697b39

File tree

1 file changed

+13
-28
lines changed

1 file changed

+13
-28
lines changed

.github/workflows/new-issue.yml

Lines changed: 13 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,20 @@
1-
name: Triage new issues
1+
name: Triage new issue
22

33
on:
4-
issues:
5-
types: [opened]
6-
7-
permissions:
8-
issues: write
4+
issues:
5+
types:
6+
- opened
97

108
jobs:
11-
triage:
9+
label_issues:
1210
runs-on: ubuntu-latest
11+
permissions:
12+
issues: write
1313
steps:
1414
- 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-
});
15+
run: gh issue edit "$NUMBER" --add-label "$LABELS"
16+
env:
17+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18+
GH_REPO: ${{ github.repository }}
19+
NUMBER: ${{ github.event.issue.number }}
20+
LABELS: needs-triage

0 commit comments

Comments
 (0)