ci: report scheduled sample test failures from a dedicated job - #2670
Merged
DariuszPorowski merged 1 commit intoSep 24, 2026
Merged
Conversation
Since #2431 the workflow sets `permissions: {}` and the test job grants only `contents: read`, so `gh issue create` in the scheduled failure path fails with "Resource not accessible by integration (createIssue)". Keep the test job read-only because it also runs pull request code. Failed scheduled legs now upload a small record artifact, and a new report-failures job that runs only for failed scheduled runs, with `issues: write` as its only permission, creates one issue per failed sample with the existing title, body, and test-failure label. Refs #2662 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Signed-off-by: Dariusz Porowski <3431813+DariuszPorowski@users.noreply.github.com>
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.OpenSSF Scorecard
Scanned Files
|
sk593
approved these changes
Sep 24, 2026
DariuszPorowski
deleted the
dariuszporowski-test-failure-issue-permissions
branch
September 24, 2026 16:42
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.
Summary
Scheduled sample-test failures stopped creating GitHub issues. This PR moves issue creation out of the
testmatrix job into a newreport-failuresjob. That job is the only one withissues: write, and it runs only for failed scheduled runs.testkeeps onlycontents: read. It runs pull request code, so it must not get issue-write access. On a failed scheduled run, each failed leg uploads a smallfailed-sample-<attempt>-<name>artifact with 1-day retention.report-failures(needs: test,if: failure() && github.event_name == 'schedule',permissions: issues: write) downloads those records and creates one issue per failed sample. Each issue keeps the same title (Samples deployment failed for <sample>), workflow-run link, andtest-failurelabel as before.POST /repos/{owner}/{repo}/issuesendpoint (gh api), which needs onlyissues: write. Thereport-failurejobs in radius-project/radius use the same approach. Downloading artifacts from the same run does not needactions: read.Samples deployment failedissue, so the failure is not lost.github.run_attempt, so re-running a scheduled run reports only the samples that failed in that attempt.Reason for change
Fixes #2662
Root cause: #2431 added
permissions: {}to the workflow andcontents: readto thetestjob. Before that, the job inherited the repository's default token permissions (write), which included issues. In the representative run 34119803387, the token had onlyContents: readandMetadata: read, andgh issue createfailed withGraphQL: Resource not accessible by integration (createIssue). The repository's default (write) doesn't apply here because an explicitpermissionsblock overrides it.Scheduled workflows run only on the default branch, so the regression took effect when
v0.55, the first release branch that includes #2431, became the default branch. The last issue created automatically was #2519 (2026-03-09, fromv0.54). The 27 scheduled failures since then (v0.57: 1,v0.59: 4,v0.60: 22) created no issues.Affected branches:
edgeandv0.55throughv0.60all have the defect. Only the default branch runs the schedule, so after this merges, cherry-pick it tov0.60to get nightly failures reported again. Release branches cut fromedgelater will include the fix automatically.Note
edgeis not the default branch, so merging this PR will not auto-close #2662. Close it after thev0.60backport.How to test
Validated locally:
actionlint,zizmor,ghalint, andyamllint(repo config) report no new findings. The only findings are the ones already onedge.run:scripts withbash -eand a stubbedghfor three cases: two failed samples, one failed sample, and no records (fallback). Each case produced the expected titles, body, andtest-failurelabel.gh apirequest payload ({"title": ..., "body": ..., "labels": ["test-failure"]}) against a repository that doesn't exist, so the call returned 404 and created nothing.Controlled failure on GitHub (not run yet, because this path only runs on
schedulefrom the default branch). After thev0.60backport, either wait for a real nightly failure or push a throwaway branch where one leg has a failing step and theschedulechecks are changed toworkflow_dispatch, then rungh workflow run test.yaml --ref <branch>. Check that:failed-sample-1-<name>report-failureslists onlyIssues: write(plusMetadata: read)On pull requests and pushes,
report-failuresshould be skipped, and thetesttoken should stayContents: read/Metadata: read.File change summary
.github/workflows/test.yamlgh issue createstep with steps that record and upload each failed sample. Added areport-failuresjob withissues: writethat creates onetest-failureissue per failed sample, or a single generic issue if no records are found.