Skip to content

feat(apply-repo-settings): add opt-in collaborators section - #88

Open
nsheaps-oura wants to merge 4 commits into
mainfrom
nate-ai/apply-repo-settings-collaborators
Open

feat(apply-repo-settings): add opt-in collaborators section#88
nsheaps-oura wants to merge 4 commits into
mainfrom
nate-ai/apply-repo-settings-collaborators

Conversation

@nsheaps-oura

Copy link
Copy Markdown
Collaborator

Summary

  • Adds a collaborators: section to the apply-repo-settings composite action: for each {username, permission} entry in settings.yml, it calls PUT /repos/{owner}/{repo}/collaborators/{username}, matching the existing repository/rulesets sections' style and their non-destructive philosophy — access for usernames not present in the list is never revoked.
  • Opt-in by design: collaborators is intentionally left out of the action's default sections input, unlike repository/rulesets. Granting push/admin access to a person is a higher-consequence, easier-to-miss change than a ruleset tweak, so callers must explicitly opt in rather than getting it silently applied by a default run.
  • Permission pre-flight finding: the collaborators PUT call needs Administration:write on the GitHub App, which the automation app already has — confirmed via GitHub's own docs for this endpoint, so no app manifest/permission change is required to use this.
  • Adds test.sh, a self-contained bash test harness (no bats/shellspec exists yet for this repo's composite actions) that stubs curl and asserts on the PUT calls action.sh makes or doesn't make, covering: applying entries, opt-in-only default behavior, no-op when the section is absent, missing-field validation, and API-error propagation. Wired into a new mise run test task and a new CI job in check.yaml so it runs on every push/PR.
  • Documents the new section in the action's README: PUT semantics, non-destructive behavior, the opt-in default rationale, and the outputs/summary key.

Test plan

  • New test.sh suite covers apply/opt-in/no-op/validation/error-propagation cases (see test(apply-repo-settings): add test coverage for collaborators)
  • Wired into CI via new check.yaml job — verify it's green on this PR
  • Reviewer: confirm the opt-in (not-in-default-sections) decision matches expectations before merge, since this is the one part of this change with real access-control consequences

nsheaps-oura and others added 4 commits July 20, 2026 16:22
PUT /repos/{owner}/{repo}/collaborators/{username} for each
{username, permission} entry in settings.yml's collaborators: list,
matching the rulesets/repository implementation's style and its
non-destructive philosophy (never revokes access absent from the list).

Opt-in only: unlike repository/rulesets, "collaborators" is not added
to the default `sections` input, since granting repo access is a
higher-consequence, easier-to-miss change than a ruleset tweak.
No bats/shellspec harness exists yet for this repo's composite
actions, so this adds a self-contained bash test.sh that stubs curl
and asserts on the PUT calls (or lack thereof) action.sh makes,
covering: applying entries, opt-in-only default behavior, no-op when
absent, missing-field validation, and API-error propagation.

Wires it into `mise run test` (new task) and a new CI job in
check.yaml so the suite actually runs on every push/PR, not just
locally. Adds mikefarah/yq to mise.toml as a dev/test dependency
(the same yq flavor action.sh requires at runtime, already installed
ad hoc inside the composite action itself for consumers).
Documents the new collaborators section: PUT semantics, non-destructive
behavior, the opt-in sections default decision and why, and the
outputs/summary key. Also notes that the existing GitHub App manifest
(administration:write) already covers the collaborators PUT call per
GitHub's docs, so no app permission change is needed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant