Repository navigation
fix(admin): let setup_repo.sh finish cleanly when the org blocks approvals - #251
Merged
jamesconwaydev merged 1 commit intoNov 6, 2026
Conversation
…ovals
The last step failed with exit 1 while the org forbids GitHub Actions
approving pull requests, so a good run looked broken. When that PUT is
refused and the org setting is the reason, the script still makes the
default workflow token read-only, prints a note saying where to allow
approvals, and finishes. Any other failure there still exits 1.
The ruleset lookup now pages, ignores org-level rulesets
(includes_parents=false), and copes with two rulesets of the same name
by updating the oldest and warning about the rest instead of building a
broken URL from both IDs.
The empty .prettierrc.json is gone. Prettier's defaults are the same as
{}, and .editorconfig is still read.
Tests run the script against a fake gh.
jamesconwaydev
approved these changes
Nov 6, 2026
jamesconwaydev
left a comment
Collaborator
There was a problem hiding this comment.
Nice. Treating the org approval setting as a note rather than a failure is the right call, and updating the oldest of the duplicates (instead of deleting) is exactly how I'd want it. The fake-gh test is a good pattern. I'll follow up separately so the script's ruleset matches the code-owner and last-push settings I turned on today.
Collaborator
|
Heads-up for next time: |
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.
What and why
Closes #54.
Org setting on the last step. When
PUT …/actions/permissions/workflowwithcan_approve_pull_request_reviews=trueis refused, the script readsorgs/devstreamhq/actions/permissions/workflow.default_workflow_permissions=read, so the default token still goes read-only. It prints a note on stderr saying auto-approve can't approve bot PRs yet and where to allow it (org Settings > Actions > General), then ends withdoneand exit 0.Ruleset lookup.
$idtwo lines, so the PUT URL broke. The lookup now reads the IDs into an array (sorted), updates the oldest, and warns with the full list. It doesn't delete the extras, since that seemed a call for you to make by hand.includes_parents=false, so an org ruleset with the same name can't be picked up (it can't be updated from the repo endpoint).--paginate..prettierrc.jsonwas{}, so it's deleted. Prettier's defaults are identical,.editorconfigis still honoured, and nothing references the file.prettier --checkover all tracked files is clean with it gone.Tests.
test_setup_repo.pyruns the real script with a fakeghonPATHthat logs every call. It covers a clean run (one PUT, one POST), duplicates (the oldest is updated, with a warning), the org blocking approvals (exit 0, a note, read-only token still set) and any other permissions failure (exit 1). All four fail against the old script. shellcheck is clean.Checks
python3 -m unittest discover -s scripts -t .passes (601)npm --prefix site testpasses (if you touchedsite/)npx prettier --check .passesdata/entries.jsonby hand (submissions go through the form)