Skip to content

chore(ci): version-control branch rulesets and label taxonomy - #2

Merged
sjungwon03 merged 2 commits into
devfrom
chore/repo-rulesets
Aug 18, 2026
Merged

sjungwon03 merged 2 commits into
devfrom
chore/repo-rulesets

Conversation

@sjungwon03

Copy link
Copy Markdown
Member

Summary

Branch protection and the label taxonomy existed only as ad-hoc API calls. This stores both as
data in the repository so they are reviewable and reproducible.

Closes #1

Validation

  • dart format . — N/A, no Dart code yet
  • flutter analyze reports no warnings — N/A, pre-scaffolding
  • flutter test passes — N/A, pre-scaffolding
  • Re-ran build_runner — N/A, no models
  • Manually validated — CI ran green on dev; ruleset JSON was rejected only by the private-repo plan limit, not by schema

Checklist

  • This pull request targets dev
  • Linked a GitHub issue above with Closes #
  • Pull request title and commits follow Conventional Commits
  • All commits are signed off with git commit -s (DCO)
  • Added or updated tests, or explained below why none are needed — no test surface; the JSON is validated by the GitHub API on apply
  • Updated documentation where behavior changed
  • Checked both Mobile and Desktop layouts — N/A
  • Checked both Light and Dark themes — N/A
  • New dependencies license-checked — none added
  • No tokens, instance hostnames, credentials, or confidential data
  • Everything in this pull request is written in English

Notes for reviewers

Two settings are deliberately not matching the reference repository:

  • required_approving_review_count is 0, not 1. With one maintainer and no bypass actors,
    requiring an approval would make every pull request unmergeable.
  • Flutter quality gate is not a required check, because it is skipped until M0 lands pubspec.yaml.

Both are documented in .github/rulesets/README.md with the exact change to make later.

Branch protection and labels lived only as ad-hoc API calls, which made them
invisible to review. Store them as data in the repository instead.

- .github/rulesets/{dev,main-release}.json — ruleset definitions
- .github/rulesets/README.md — how to apply them, and the two settings that
  must change later (approval count once a second maintainer exists, the
  Flutter check once M0 lands)
- .github/labels.sh — idempotent label sync
- Document both in .agents/docs/workflow.md

The rulesets are not applied yet. GitHub rejects ruleset creation on a private
repository on the free plan, so they land when the repository goes public.

Closes #1

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Signed-off-by: sjungwon03 <sjungwon03@gmail.com>

@sjungwon03-ai sjungwon03-ai left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solid move to version-control the rulesets and label taxonomy instead of ad-hoc API calls. Both JSON files are schema-valid, the labels script is idempotent, and the README documents the two deferred settings (review count → 1, Flutter gate as required check) with the exact edit to make later. CI is green. LGTM.

Comment thread .github/labels.sh Resolved
Comment thread .github/rulesets/dev.json Resolved
Review feedback on #2: the script ran with `set -u` and chained the success
message with `&&`, so a failing `gh label create` printed nothing and the sync
still exited 0. A partial sync looked identical to a complete one.

Use `set -euo pipefail`, branch explicitly on the create result, count failures,
and exit non-zero from an EXIT trap. Also allow overriding the target repository
with LABELS_REPO so the script can be tested against a scratch repo.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Signed-off-by: sjungwon03 <sjungwon03@gmail.com>
@sjungwon03

Copy link
Copy Markdown
Member Author

Addressed the labels.sh finding in the follow-up commit: set -euo pipefail, an explicit failure branch instead of &&, a failure counter, and a non-zero exit from an EXIT trap. Verified by running the sync against the live repository — 46 labels report ok and the script ends with Label sync complete.

On strict_required_status_checks_policy: false: confirmed intentional. Forcing every branch up to date would mean rebasing each open pull request whenever dev moves, which is friction a squash-only flow does not need. Noted in .github/rulesets/README.md as a setting to revisit if the contributor count grows.

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.

chore: version-control branch rulesets and label taxonomy

2 participants