Use Project Type=Bug for workflow-failure issue automation - #5531
Use Project Type=Bug for workflow-failure issue automation#5531Shankar Seal (shankarseal) with Copilot wants to merge 10 commits into
Conversation
Co-authored-by: shankarseal <74580197+shankarseal@users.noreply.github.com>
|
Copilot Also update the check-wdk.yml workflow, which should be Type Task instead of Label bug |
Co-authored-by: dthaler <6547784+dthaler@users.noreply.github.com>
Dave Thaler (dthaler)
left a comment
There was a problem hiding this comment.
Looks ok, I guess. Hard to tell for sure until github tries it.
|
Copilot Can you investigate and make the necessary changes and push? |
Co-authored-by: shankarseal <74580197+shankarseal@users.noreply.github.com>
7e54a66
Fixed in 7e54a66. The workflow parser error was caused by using an invalid permission key ( |
Co-authored-by: shankarseal <74580197+shankarseal@users.noreply.github.com>
Co-authored-by: shankarseal <74580197+shankarseal@users.noreply.github.com>
Co-authored-by: shankarseal <74580197+shankarseal@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
Project-write permissions need tighter scoping, and Project v2 queries need pagination.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Updates workflow issue automation to use GitHub Project v2 Type=Bug instead of the bug label.
Changes:
- Adds shared GraphQL logic for Project v2 type assignment.
- Updates workflow-failure and WDK issue classification.
- Adds required project permissions.
File summaries
| File | Summary | Final findings |
|---|---|---|
.github/workflows/reusable-test.yml |
Classifies failed-test issues as Bug. |
Project-write permission is broader than necessary (moderate, 1 vote). |
.github/workflows/reusable-set-issue-type.yml |
Discovers projects and updates issue types. | Project, item, and field connections require pagination (moderate, 2 votes; moderate, 1 vote). |
.github/workflows/netperf.yml |
Classifies NetPerf failures as Bug. |
Project-write token is exposed to an unpinned script; scope permission to the issue-type job (critical, 1 vote). |
.github/workflows/cicd.yml |
Grants project permissions to reusable workflows. | Workflow-level project-write grant is too broad (moderate, 1 vote). |
.github/workflows/check_wdk.yml |
Uses shared logic for Task classification. |
No final findings. |
Review details
Suppressed comments (4)
.github/workflows/cicd.yml:41
- This workflow-level grant is inherited by every job in CI, including unrelated build, test, and analysis jobs. It gives those jobs a project-write token even though only the reusable issue-automation callers need it; move the grant to the specific reusable-workflow call jobs so other jobs retain no Project write access.
repository-projects: write # Required by reusable workflows that set Project Type.
.github/workflows/reusable-set-issue-type.yml:84
fields(first: 50)has the same unbounded-connection problem: a project with more than 50 fields can have itsTypefield on a later page, causingtype_fieldto be undefined and this code to silently skip that project. Follow the field cursor instead of treating a truncated response as a project without a Type field.
fields(first: 50) {
.github/workflows/reusable-set-issue-type.yml:49
- These ProjectV2 connections are queried with fixed
firstlimits and no cursors. Once the repository has more than 20 projects (or an issue has more than 100 project items / a project has more than 50 fields), matching boards or theTypefield can be silently omitted, so the issue will not be classified everywhere as intended. Paginate the project, project-item, and field connections before iterating.
projectsV2(first: 20) {
.github/workflows/reusable-test.yml:67
- This workflow-level grant is also inherited by
run_test, which executes checked-out test commands. Only the issue-creation and issue-type jobs need Project write access; keep the permission on those jobs and downscoperun_testso test code and its actions cannot use a project-write token.
repository-projects: write # Required to set Type=Bug on project items.
- Files reviewed: 5/5 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| permissions: | ||
| contents: read | ||
| issues: write # Required to create issues. | ||
| repository-projects: write # Required to set Type=Bug on project items. |
| const projects_response = await github.graphql( | ||
| `query($owner: String!, $repo: String!) { | ||
| repository(owner: $owner, name: $repo) { | ||
| projectsV2(first: 20) { |
Description
Workflow-failure issues were still tagged with the
buglabel after moving to Project v2Type=Bug. This PR updates the failure-issue automation inreusable-test.ymlandnetperf.ymlto classify failures via Project Type instead of label-based bug tagging.Scope
.github/workflows/reusable-test.yml.github/workflows/netperf.ymlBehavior changes
bugfrom auto-created issue labels; keepci/cdand existing conditional labels.projects: writepermission required for Project v2 field updates.actions/github-scriptlogic to:Typesingle-select field andBugoption,Type=Bugfor created/updated workflow-failure issues.Implementation excerpt
Testing
No new test assets were added; the change is scoped to workflow automation logic.
If new tests were added:
Documentation
No documentation impact.
Installation
No installer impact.