Skip to content

feat: pin required checks to an app, manage org Actions workflow settings - #45

Merged
gold-silver-copper merged 3 commits into
mainfrom
feat/pinned-checks-org-actions
Nov 19, 2026
Merged

gold-silver-copper merged 3 commits into
mainfrom
feat/pinned-checks-org-actions

Conversation

@gold-silver-copper

@gold-silver-copper gold-silver-copper commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Two additions gitkb/org needs before gitkb-core switches CI (panel decision 2026-11-19, Q2 and Q4).

Required checks pinned to an app

Before, required_checks was a list of names. gh-config kept a pin the ruleset already had but couldn't set one, and the drift check ignored pins.

# before
required_checks: [gate / CI gate]
# after: plain names still work (no pin); a pinned check names its app
required_checks:
  - Lint
  - {context: "gate / CI gate", app_id: 15368}   # 15368 = GitHub Actions
  • sync sends the pin as integration_id. The no-op check and diff compare it, so a missing or wrong pin counts as drift. sync-from-org writes it back, so drift PRs keep it.
  • Only an app_id in the config sets or changes a pin. A plain name keeps the pin the ruleset already has, as before, so sync never removes one. diff shows a live pin the file doesn't name, and sync-from-org records it.
  • Rewriting Require CI now keeps the ruleset's branch conditions and strict_required_status_checks_policy. Before, it reset them to ~DEFAULT_BRANCH and not strict, so a pin update could have narrowed or weakened a ruleset. A ruleset that targets anything but branches, or has no conditions, is refused. A live read on 2026-11-19 found all 67 gitkb Require CI rulesets active, on ~DEFAULT_BRANCH only, not strict, enforced on create, and none pinned, so none would have been weakened.
  • A name listed twice is still refused, whether pinned or not.

Org Actions workflow settings

actions:
  default_workflow_permissions: read          # read | write
  can_approve_pull_request_reviews: false
  • Applied with PUT /orgs/{org}/actions/permissions/workflow, and only when they differ from GitHub. --dry-run prints the change. It runs after the bypass-list checks and before teams and repos.
  • Without the block, sync leaves these settings alone and diff doesn't compare them. sync-from-org always records them when it can read them. A failed read is logged at the default level, and the last line names what wasn't recorded instead of saying "completed successfully". If the file has the block, its values are kept and diff exits 1.
  • It needs the org's administration permission: Organization → Administration Read for GET and Write for PUT (classic PAT: admin:org). The gitkb Org Config App doesn't have that today.
  • Unknown keys, a missing key or an unknown value are refused when the config loads.

Tests

  • config: the two ways to write a check; appid, a missing app_id and a duplicate are refused; the actions block's keys and values.
  • github (mockito): unpinned and wrong-pinned rulesets are drift, sync rewrites only those two with the pin, the export writes each pin back and its diff is clean; Actions settings are written once, a dry run and a matching config write nothing, they round-trip, and a config without the block shows no diff. A plain name over a live pin writes nothing; a rewrite keeps the live pin, the branches and strictness; an Actions read that fails (403) is named and not drift without the block, and kept and drift with it.

Not verified here: nothing was built or run locally, so CI is the only test. Not checked against live GitHub: the PUT itself, and whether gitkb/org's token can read and write the org workflow settings (that needs org administration access).

…ings

A required check may be written as {context: <name>, app_id: <id>}; plain
names keep working and mean no pin. sync sends the pin as integration_id,
diff and the no-op check compare it, and sync-from-org writes it back.

A top-level actions block holds the org's default_workflow_permissions and
can_approve_pull_request_reviews (PUT /orgs/{org}/actions/permissions/workflow).
Without the block they are left alone and not compared.
@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Explain Change →

Warning

Review limit reached

  • Run on-demand review

This review includes 3 billable files and costs up to $0.75.

  • Ask an admin to make reviews automatic

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Or wait 34 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 114 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Team
  • Run ID: 7ead20ee-2f23-41b4-8d4a-00eac4fde84f
Commits

Reviewing files that changed from the base of the PR and between cd5c4ab and c3cdf75.

Files selected for processing: 3

  • README.md
  • docs/changelog.md
  • src/github.rs

No actionable comments were generated in the recent review.

Walkthrough

This PR adds app-pinned required checks and optional organization Actions settings to the configuration model, GitHub sync and diff logic, exported YAML, tests, and documentation.

Changes

Pinned checks and organization Actions settings

Layer / File(s) Summary
Config contracts and validation
src/config.rs
Repo.required_checks now uses RequiredCheck, which supports either a plain context string or a {context, app_id} object. The config also adds optional actions settings with workflow permissions and pull-request review approval fields. Validation and parsing tests cover accepted forms and error cases.
GitHub read, diff, sync, and export flow
src/github.rs
GitHub ruleset handling now maps app_id to GitHub integration_id, compares full required-check values, and exports pins. The org flow now reads, diffs, syncs, and exports managed Actions settings, with dry-run handling, unreadable-setting handling, updated mocks, and coverage for pin drift and Actions round-trips.
Docs and examples
README.md, docs/usage.md, docs/changelog.md
The docs now show pinned and unpinned required checks, describe how sync and sync-from-org handle pins, and document the optional top-level actions block and its managed-fields behavior.

Estimated code review effort: 4 (Complex) | ~50 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant Config
  participant Sync
  participant GitHub Org Actions API
  participant GitHub Ruleset API
  Sync->>GitHub Org Actions API: Read managed Actions settings
  Sync->>GitHub Ruleset API: Read required checks and integration_id
  Sync->>GitHub Org Actions API: PUT configured Actions settings when different
  Sync->>GitHub Ruleset API: Update required checks with context and app_id
Loading

Possibly related PRs

  • gitkb/gh-config-cli#39: This PR changed the same required_checks flow that this PR now extends with {context, app_id} entries, pin comparison, and updated sync and export behavior.

Suggested reviewers: mateodelnorte

Merge Risk: Minimal · previous review cd5c4

The change adds app-pinned required checks and optional organization Actions settings, and no concrete defect was found in review. Live GitHub behavior for clearing a pin and for the Actions PUT has not been exercised, so check a dry-run sync before relying on it broadly.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "feat: pin required checks to an app, manage org Actions workflow settings" matches the main changes in the raw summary and objectives. The summary covers app-pinned required checks via {con…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Full details: Title check

Explanation

The title "feat: pin required checks to an app, manage org Actions workflow settings" matches the main changes in the raw summary and objectives. The summary covers app-pinned required checks via {context, app_id} entries, and the new top-level actions block for organization workflow permissions and PR review approval. The title is specific and concise, and it names both primary changes. It is 73 characters, which is acceptable for a conventional-commit style title.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
Fix failing CI checks

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

I tapped the config with one careful paw,
and pinned each check to the app that I saw.
I carried new Actions settings up the hill,
then taught sync and diff to follow them still.
Now the YAML burrow is tidy and bright,
and this small rabbit sleeps well tonight.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Team
  • Run ID: feab7ff6-e1fd-405b-b0bf-cf66c675b1cf
Commits

Reviewing files that changed from the base of the PR and between 7214153 and cd5c4ab.

Files selected for processing: 5

  • README.md
  • docs/changelog.md
  • docs/usage.md
  • src/config.rs
  • src/github.rs

Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

@coderabbitai
coderabbitai Bot requested a review from mateodelnorte November 19, 2026 22:42
…tings

A plain check name keeps the pin its ruleset has: only an app_id sets or
changes one, so sync never removes a pin. Rewriting Require CI keeps the
ruleset's branch conditions and strict policy instead of resetting them to
the default branch and not strict; a ruleset gh-config can't keep that for
is refused. sync-from-org logs Actions settings it couldn't read at the
default level and names them in its last line instead of reporting
success. README: the Actions block needs org Administration read/write.
@gold-silver-copper
gold-silver-copper force-pushed the feat/pinned-checks-org-actions branch from 625109e to c3cdf75 Compare November 19, 2026 23:06
@gold-silver-copper
gold-silver-copper merged commit 1535c2e into main Nov 19, 2026
8 checks passed
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