-
Notifications
You must be signed in to change notification settings - Fork 527
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement triaging helper #4594
Comments
Another feature that would be nice to have: automatically move issues into "In progress" when someone self-assigns. |
To automate issue triage in your GitHub repository, I have created a workflow file (.github/workflows/issue-triage.yml) and configured it to trigger on issue events like opened or labeled. This workflow automatically comments on new issues, checks for required labels (e.g., bug, Impact: High), and adds or removes a needs-triage label based on label completeness.Also checks for the assigned project team. name: Issue Triage and Management
on:
issues:
types: [opened, labeled]
issue_assigned:
types: [assigned]
jobs:
triage-on-issue-open:
runs-on: ubuntu-latest
if: github.event.sender.login != 'github-actions'
steps:
- name: Reply to Issue
uses: peter-evans/issues-comment-action@v2
with:
issue-number: ${{ github.event.issue.number }}
comment: >
Thanks for filing the issue! We’ll review it shortly and route it to the correct team.
- name: Check Labels for Proper Triaging
id: check-labels
uses: actions/github-script@v6
with:
script: |
const issue = await github.rest.issues.get({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number
});
const labels = issue.data.labels.map(label => label.name);
const requiredLabels = {
types: ['bug', 'enhancement', 'good first issue'],
impacts: ['Impact: High', 'Impact: Medium', 'Impact: Low'],
work: ['Work: High', 'Work: Medium', 'Work: Low'],
priorities: ['Priority: Essential', 'Priority: Important', 'Priority: Nice-to-have']
};
const hasTypeLabel = labels.some(label => requiredLabels.types.includes(label));
const hasImpactLabel = labels.some(label => requiredLabels.impacts.includes(label));
const hasWorkLabel = labels.some(label => requiredLabels.work.includes(label));
const hasPriorityLabel = labels.some(label => requiredLabels.priorities.includes(label));
const needsTriage = !(hasTypeLabel && hasImpactLabel && hasWorkLabel && hasPriorityLabel);
core.setOutput('needs-triage', needsTriage);
- name: Add Needs Triage Label
if: steps.check-labels.outputs.needs-triage == 'true'
uses: actions/labeler@v3
with:
labels: needs-triage
- name: Remove Needs Triage Label
if: steps.check-labels.outputs.needs-triage == 'false'
uses: actions/labeler@v3
with:
remove: needs-triage
- name: Verify Project Assignment
uses: actions/github-script@v6
with:
script: |
const projects = await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
});
const openProjects = projects.data.filter(project => project.state === 'open');
if (openProjects.length !== 1) {
throw new Error(`Issue must be assigned to exactly one open project. Found: ${openProjects.length}`);
}
console.log(`Valid project assignment: ${openProjects[0].name}`);
@adhiamboperes , @BenHenning Do check this out. Thank you |
@Mayank77maruti this looks like a good attempt. A few notes: The on:
issues:
types: [opened, labeled, assigned] Additionally, have you considered using Please create a PR so that we can review this further. |
Is your feature request related to a problem? Please describe.
When triaging, there are specific criteria that must be met to ensure that the issue is properly triaged. Furthermore, it's nice to get quick acknowledgement after filing an issue.
Describe the solution you'd like
A GitHub Action that automatically replies to incoming issues with a message like: "Thanks for filing the issue, we'll be following up shortly to route this to the correct team." Beyond that, the workflow should verify that exactly one open project is assigned to the issue, and that exactly one of each type of these labels is assigned: issue type, work, and impact. If any of these criteria fail to be met, the issue should be automatically labeled with "needs triage." If all of them are met, "needs triage" should be removed.
Describe alternatives you've considered
Manually managing the issues with a search query for issues that need triage, but unfortunately GitHub's search syntax is too limited to actually search for the criteria above. Alternatively we could maintain a "triaged" label, but it'd be nicer to minimize long-term permanent labels.
Additional context
None.
The text was updated successfully, but these errors were encountered: