fix(ci): degrade gracefully when Actions may not open PRs - #517
Open
Jayanth Reddy Bujula (jbujula) wants to merge 1 commit into
Open
fix(ci): degrade gracefully when Actions may not open PRs#517Jayanth Reddy Bujula (jbujula) wants to merge 1 commit into
Jayanth Reddy Bujula (jbujula) wants to merge 1 commit into
Conversation
Ports the fix from powerplatform-build-tools#1462. The weekly refresh workflow added in #507 is the same one, so it has the same latent failure. In build-tools the first real run did all of its work -- npm ci, npm update, audit-overrides, build and test -- pushed its branch, and then failed on the last step with: pull request create failed: GraphQL: GitHub Actions is not permitted to create or approve pull requests (createPullRequest) That is the org/repo policy "Allow GitHub Actions to create and approve pull requests", not a workflow bug, and no token or permissions change avoids it. Failing the run every week for something the workflow cannot satisfy just teaches people to ignore the job, so the step now distinguishes: - that specific policy error -> ::warning:: plus a job summary with a prefilled compare link and the PR body, exit 0 (branch is pushed and green, so it is one click away), - any other error -> exit 1, unchanged. The gh error is printed either way. Verified in the build-tools PR with a stubbed gh reproducing the exact stderr: policy error -> exit 0 with summary; unrelated error -> exit 1. yaml parses and bash -n is clean on the extracted step here too. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6ac571cd-d84e-4b40-805a-e316a62ed292
Jayanth Reddy Bujula (jbujula)
requested review from
Brad Flood (brflood) and
heiwang
August 14, 2026 01:32
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.
Ports powerplatform-build-tools#1462. The weekly refresh workflow added here in #507 is the same workflow, so it carries the same latent failure - I found it by actually running the build-tools copy rather than assuming it worked.
What happened over there
Run: https://github.com/microsoft/powerplatform-build-tools/actions/runs/31760462499
Every meaningful step passed -
npm ci,npm update,audit-overrides.js, build and test - and the branch was pushed. Then the final step failed:That is the repo/org policy Settings > Actions > General > "Allow GitHub Actions to create and approve pull requests". It is not a workflow bug, and no token or
permissions:change avoids it - it applies toGITHUB_TOKEN-driven Actions runs.The change
Failing the whole run for a policy the workflow cannot satisfy would put a red X on the weekly job every week, which reliably trains people to stop looking at it. Silently passing would hide real breakage. So the step distinguishes the two cases:
::warning::+ job summary with a prefilled compare link and the full PR body, exit 0The underlying
gherror is printed in both cases, and the branch is already pushed and green at that point, so the refresh is recoverable in one click from the run summary.If an admin enables the setting, nothing here needs to change - runs will simply open their own PRs and never reach the fallback.
Verification
Tested in the build-tools PR with a stubbed
ghreproducing the exact stderr:For this repo specifically:
yaml.loadparses the workflow andbash -nis clean on the extracted step script.Worth noting
The build-tools run was not wasted - its output became powerplatform-build-tools#1461, upgrading
nanoid3.3.17 -> 3.3.18 and clearing GHSA-2v37-7h3g-55p8 (HIGH). That is the advisory documented on #506 as not-yet-fixable because3.3.18was not mirrored onpackagefeedproxy.microsoft.io. The mirror has since synced.This repo still shows the same 4 highs from that one dev-only chain (
nanoid->postcss->@gulp-sourcemaps/identity-map->gulp-sourcemaps). Thenanoidoverride here is already^3.3.17, so once this workflow runs it should pick up3.3.18the same way.