Skip to content

Report Codespaces prebuild failures in GitHub issues#8191

Open
joshblack with Copilot wants to merge 16 commits into
mainfrom
copilot/add-workflow-failure-issue
Open

Report Codespaces prebuild failures in GitHub issues#8191
joshblack with Copilot wants to merge 16 commits into
mainfrom
copilot/add-workflow-failure-issue

Conversation

Copilot AI commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Adds failure reporting for monitored workflows, initially Codespaces Prebuilds. Each failure creates an issue linking failed jobs and prompting @github/primer-engineering.

Changelog

New

  • Workflow monitor with an extensible workflow list.
  • Failure issues titled “Investigate GitHub workflow failure.”
  • Issue body listing the failed workflow and linked jobs.

Changed

  • None.

Removed

  • None.

Rollout strategy

  • Patch release
  • Minor release
  • Major release; if selected, include a written rollout or migration plan
  • None; CI-only change with no published package impact.

Testing & Reviewing

  • Review the workflow trigger, scoped permissions, and generated issue format.

Copilot AI and others added 2 commits July 17, 2026 18:31
Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>
Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>
@changeset-bot

changeset-bot Bot commented Jul 17, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: f8490ca

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copilot AI changed the title Add workflow failure issue reporting Report Codespaces prebuild failures in GitHub issues Jul 17, 2026
Copilot AI requested a review from joshblack July 17, 2026 18:36

@joshblack joshblack left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@copilot let's just have it make a contextual workflow and the title should include the workflow name e.g. Investigate {workflow_name} workflow failure. It should not duplicate issues if one already exists, instead it should update the issue with the latest failure. It should also close any open failure issues for the workflows if they pass.

Copilot AI and others added 5 commits July 17, 2026 18:48
Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>
Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>
Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>
Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>
Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>

Copilot AI commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

@copilot let's just have it make a contextual workflow and the title should include the workflow name e.g. Investigate {workflow_name} workflow failure. It should not duplicate issues if one already...

Implemented in 28cc6ee and finalized in 44672e3. Issues now use Investigate {workflow_name} workflow failure, update the existing workflow issue with the latest failure, and close open failure issues after a successful run.

Copilot AI requested a review from joshblack July 17, 2026 19:02

@joshblack joshblack left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@copilot split this into two steps:

  • create-or-update-issue if the workflow failed
  • close-issue if the workflow succeeded

apply appropriate logic to each

Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>

Copilot AI commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

@copilot split this into two steps:

  • create-or-update-issue if the workflow failed...

Implemented in 3dd27f1. Failure runs now use create-or-update-issue, while successful runs use the independently gated close-issue job.

Copilot AI requested a review from joshblack July 17, 2026 19:15
@joshblack joshblack added skip changeset This change does not need a changelog integration-tests: skipped manually Changes in this PR do not require an integration test labels Jul 17, 2026
@joshblack
joshblack marked this pull request as ready for review July 17, 2026 19:17
Copilot AI review requested due to automatic review settings July 17, 2026 19:17
@joshblack
joshblack requested a review from a team as a code owner July 17, 2026 19:17

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.

Pull request overview

Adds a new GitHub Actions workflow that monitors selected workflow_run completions (initially “Codespaces Prebuilds”) and opens/updates an issue on failures, then closes the issue once the monitored workflow succeeds.

Changes:

  • Introduces .github/workflows/report-workflow-failures.yml to create/update a single “workflow failure” issue per monitored workflow when the latest completed run fails.
  • Includes job-level links for failed jobs (falling back to the run link when no failed jobs are found).
  • Automatically closes the open failure issue(s) for that workflow when the latest completed run succeeds.
Show a summary per file
File Description
.github/workflows/report-workflow-failures.yml New workflow that creates/updates/closes GitHub issues in response to monitored workflow failures/successes.

Review details

  • Files reviewed: 1/1 changed files
  • Comments generated: 3
  • Review effort level: Low

Comment thread .github/workflows/report-workflow-failures.yml
Comment on lines +78 to +80
const failedJobLinks = failedJobs.map(
(job) => `[${job.name}](${job.html_url})`,
);
Comment thread .github/workflows/report-workflow-failures.yml Outdated

@joshblack joshblack left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@copilot apply review suggestions. Also investigate if we can assign copilot automatically to the issue to try and fix it

Copilot AI and others added 4 commits July 17, 2026 19:36
Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>
Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>
Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>
Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>
@github-actions
github-actions Bot temporarily deployed to storybook-preview-8191 July 17, 2026 19:48 Inactive
Copilot AI and others added 3 commits July 17, 2026 19:49
Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>
Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>
Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>

Copilot AI commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

@copilot apply review suggestions. Also investigate if we can assign copilot automatically to the issue to try and fix it

Addressed in f8490ca. I applied the review feedback by narrowing issue lookup to matching failure issues, avoiding issue flapping when a newer run is still pending, and formatting failed-job links safely. I also investigated Copilot assignment and added a best-effort copilot assignment when creating/updating the issue; if Copilot assignment isn't enabled for the repository, the workflow logs a warning instead of failing.

Comment on lines +161 to +166
const latestRuns = await github.rest.actions.listWorkflowRuns({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: workflowRun.workflow_id,
per_page: 1,
});

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

non-blocking The create-or-update-issue job filters this to status: 'completed', but this one doesn't, so if a newer run is queued or in progress when a success comes in, the guard bails and the issue never gets closed. Should it match the create job?

Suggested change
const latestRuns = await github.rest.actions.listWorkflowRuns({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: workflowRun.workflow_id,
per_page: 1,
});
const latestRuns = await github.rest.actions.listWorkflowRuns({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: workflowRun.workflow_id,
status: 'completed',
per_page: 1,
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration-tests: skipped manually Changes in this PR do not require an integration test skip changeset This change does not need a changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants