Fix Copilot artifact cleanup failing with HTTP 403#355
Closed
Conversation
Co-authored-by: talgalili <976006+talgalili@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix cleanup of copilot artifacts for run IDs
Fix Copilot artifact cleanup failing with HTTP 403
Mar 3, 2026
There was a problem hiding this comment.
Pull request overview
Adds a repository-owned GitHub Actions workflow to clean up artifacts produced by the “Copilot code review” workflow run, avoiding the existing cleanup failure caused by insufficient permissions (HTTP 403) when using the scoped Copilot token.
Changes:
- Introduces a new
workflow_run-triggered cleanup workflow targeting “Copilot code review” completions. - Grants
actions: writesoGITHUB_TOKENcan delete artifacts in the base-branch context. - Implements best-effort deletion behavior (warn on per-artifact delete failures).
|
@talgalili has imported this pull request. If you are a Meta employee, you can view this in D95045275. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Contributor
|
@Copilot has updated the pull request. You must reimport the pull request before landing. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Contributor
|
@Copilot has updated the pull request. You must reimport the pull request before landing. |
|
@talgalili merged this pull request in b5f2497. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The "Copilot code review" dynamic workflow's built-in "Cleanup artifacts" job fails with
HTTP 403because it uses the scopedGITHUB_COPILOT_API_TOKENforgh apicalls, which lacks artifact deletion permissions.Changes
.github/workflows/cleanup-copilot-artifacts.ymlthat supersedes the broken built-in cleanup:workflow_runon completion of "Copilot code review" — runs in the base-branch context whereGITHUB_TOKENhas full repo permissionspermissions: actions: writeexplicitly soGITHUB_TOKENcan delete artifactsOriginal prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.