Skip to content

Use Project Type=Bug for workflow-failure issue automation - #5531

Open
Shankar Seal (shankarseal) with Copilot wants to merge 10 commits into
mainfrom
copilot/update-workflow-bug-reporting
Open

Use Project Type=Bug for workflow-failure issue automation#5531
Shankar Seal (shankarseal) with Copilot wants to merge 10 commits into
mainfrom
copilot/update-workflow-bug-reporting

Conversation

Copilot AI commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Description

Workflow-failure issues were still tagged with the bug label after moving to Project v2 Type=Bug. This PR updates the failure-issue automation in reusable-test.yml and netperf.yml to classify failures via Project Type instead of label-based bug tagging.

  • Scope

    • .github/workflows/reusable-test.yml
    • .github/workflows/netperf.yml
  • Behavior changes

    • Remove bug from auto-created issue labels; keep ci/cd and existing conditional labels.
    • Add projects: write permission required for Project v2 field updates.
    • Extend actions/github-script logic to:
      • discover repository Project v2 boards,
      • resolve the Type single-select field and Bug option,
      • add the issue to project(s) when needed,
      • set Type=Bug for created/updated workflow-failure issues.
  • Implementation excerpt

await github.graphql(
  `mutation($projectId: ID!, $itemId: ID!, $fieldId: ID!, $optionId: String!) {
    updateProjectV2ItemFieldValue(input: {
      projectId: $projectId,
      itemId: $itemId,
      fieldId: $fieldId,
      value: { singleSelectOptionId: $optionId }
    }) { projectV2Item { id } }
  }`,
  { projectId, itemId, fieldId, optionId }
);

Testing

No new test assets were added; the change is scoped to workflow automation logic.

If new tests were added:

  • Unit tests are added.
  • Driver tests are added.
  • Fuzz tests are added.

Documentation

No documentation impact.

Installation

No installer impact.

Co-authored-by: shankarseal <74580197+shankarseal@users.noreply.github.com>
Copilot AI changed the title [WIP] Update 'Workflow failed' issues to use Type Bug Use Project Type=Bug for workflow-failure issue automation Aug 24, 2026
@dthaler

Copy link
Copy Markdown
Collaborator

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>

Copilot AI commented Aug 24, 2026

Copy link
Copy Markdown
Contributor Author

Copilot Also update the check-wdk.yml workflow, which should be Type Task instead of Label bug

Updated in d58a815. check_wdk.yml now removes the bug label usage and sets Project v2 Type to Task via GraphQL, including the required projects: write permission.

@dthaler Dave Thaler (dthaler) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks ok, I guess. Hard to tell for sure until github tries it.

@shankarseal

Copy link
Copy Markdown
Collaborator

Copilot
Looks like the YMLs are incorrect and several checks are failing with errors like
error parsing called workflow ".github/workflows/cicd.yml" -> "./.github/workflows/reusable-test.yml" : (Line: 67, Col: 3): Unexpected value 'projects'

Can you investigate and make the necessary changes and push?

Co-authored-by: shankarseal <74580197+shankarseal@users.noreply.github.com>

Copilot AI commented Sep 10, 2026

Copy link
Copy Markdown
Contributor Author

Copilot
Looks like the YMLs are incorrect and several checks are failing with errors like
error parsing called workflow ".github/workflows/cicd.yml" -> "./.github/workflows/reusable-test.yml" : (L...

Fixed in 7e54a66. The workflow parser error was caused by using an invalid permission key (projects). I updated reusable-test.yml, netperf.yml, and check_wdk.yml to use repository-projects: write and validated all three YAML files parse successfully.

Co-authored-by: shankarseal <74580197+shankarseal@users.noreply.github.com>
Co-authored-by: shankarseal <74580197+shankarseal@users.noreply.github.com>
Comment thread .github/workflows/reusable-set-issue-type.yml Outdated
Comment thread .github/workflows/reusable-set-issue-type.yml Outdated
Comment thread .github/workflows/reusable-test.yml Outdated
Comment thread .github/workflows/netperf.yml Outdated
Co-authored-by: shankarseal <74580197+shankarseal@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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 its Type field on a later page, causing type_field to 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 first limits 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 the Type field 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 downscope run_test so 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) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

"Workflow failed" bugs should be filed with Type Bug instead of Label bug

5 participants