Skip to content
kattakathPublic

About

The fleet's shared landing system: one required gate check, reusable CI workflows, rulesets and community defaults.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

kattakath/.github

ci: build status on main license: MIT

The fleet's shared landing system: one required gate check, reusable CI workflows, rulesets and community defaults.

Every public repo in the fleet requires exactly one check, gate. The operator lands changes by a direct push to main; bot and fork PRs land through GitHub Merge Queue where GitHub offers one, and auto-merge everywhere else. Why it has this shape: docs/explanation/landing-system.md.

Install

Adopt it in a repo with a CI workflow shaped like this one (this repo's own ci.yml is the working example):

on:
  pull_request:
  merge_group:
    types: [checks_requested]
  push:                     # the operator's direct pushes get the same suite
    branches: [main]
  workflow_dispatch:
concurrency:
  # A push run is keyed on its sha, so a newer push never cancels an older one's run.
  group: ci-${{ github.event.pull_request.number || (github.event_name == 'push' && github.sha) || github.ref }}
  cancel-in-progress: ${{ github.event_name == 'pull_request' }}   # never cancel a queue run
permissions:
  contents: read            # no secrets in CI: merge_group runs fork code in base-repo context
jobs:
  quick:                    # optional, cheap, never required
    if: github.event_name == 'pull_request'
  heavy:                    # the repo's real suite; any number of jobs with this if:
    if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository || vars.QUEUE_ENABLED != 'true'
  gate:                     # THE ONLY REQUIRED CHECK; never rename it
    if: ${{ !cancelled() }}
    needs: [quick, heavy]
    runs-on: ubuntu-24.04
    steps:
      - uses: kattakath/.github/actions/gate@<sha>
        with:
          needs: ${{ toJSON(needs) }}
          # A deliberate second copy of heavy's if:. If the two copies drift, gate goes red.
          expect: >-
            {"quick": ${{ github.event_name == 'pull_request' }},
             "heavy": ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository || vars.QUEUE_ENABLED != 'true' }}}

Then:

  1. Add the auto-merge, arm-dependabot and status-labels callers. Each reusable file's header has the snippet.
  2. Land that change under the repo's current rules.
  3. Run scripts/apply-ruleset.sh OWNER/REPO and read the diff, then re-run with --apply.
    • On Tier A it sets QUEUE_ENABLED only after the queue rule exists.
    • It refuses to replace a ruleset that requires checks other than gate.
  4. Open WIP PRs as drafts. gate goes green on a PR in seconds, so an armed PR is queued at once.

Pin a release, not a bare commit. Write every uses: of this repo as @<sha> # vX.Y.Z, taking the SHA of a tag from Releases. Keep a github-actions entry in the repo's dependabot.yml:

  • A pin on a tagged SHA gets a bump PR for each new release.
  • A pin on an untagged SHA jumps to the head of main instead.
  • With no tag at all, a pin is never bumped.

release.yml cuts a tag after ci passes on main whenever VERSION is new. Bump VERSION in the commit that changes what callers get; ci fails if you forget.

A new repo can start in shape instead: scripts/new-repo.sh (below). Measured failure modes: docs/reference/pitfalls.md.

API

Path What it is
actions/gate Composite action. Fails unless every job the caller's gate job needs ended exactly as expected: success where it should run, skipped where it shouldn't.
actions/issue-keeper Composite action. Keeps ONE open issue, matched by exact title, in step with a check: state: problem opens it, or comments once when body changes; state: ok closes it. assignee-id is assigned only if it resolves to a User account. Bad input fails before any API call. The caller job needs issues: write.
.github/workflows/auto-merge.yml Reusable. Arms squash auto-merge on same-repo, non-draft, non-Dependabot PRs, using a GitHub App token.
.github/workflows/arm-dependabot.yml Reusable. Arms Dependabot PRs from a schedule. A Dependabot-triggered run can't read the App key.
.github/workflows/nix-flake-check.yml Reusable. nix flake check on both Linux arches with Determinate Nix and the public kattakath Cachix (read-only). One copy for every flake repo; its header has the caller snippet, with gate kept top-level.
.github/workflows/update-flake-lock.yml Reusable. Weekly flake input bump with the CI App token: update-flake-lock opens the PR and the shared land step arms or merges it. Optional inputs-exclude and a heartbeat. Its header has the caller snippet.
.github/workflows/status-labels.yml Reusable. Keeps auto-merge (green) and merge-queue (purple) labels in sync with the live PR state, so they show up in the PR list. Derived on every event, never trusted. Its header has the caller snippet.
rulesets/main.json, rulesets/merge-queue.json The default-branch ruleset: squash only, gate required (from GitHub Actions only), admin bypass. Plus the queue rule.
scripts/apply-ruleset.sh Makes a repo match the ruleset, plus its landing settings and its security settings (private vulnerability reporting included). Dry run by default.
scripts/new-repo.sh Creates a public fleet repo that starts in shape: repo-kit's init, the first push, apply-ruleset.sh --apply, the CI bot secret for a user-owned repo (from the Keychain), and the nix-config entries to land next.

Community health defaults

GitHub serves the files in .github/ to every public kattakath repository that has no copy of its own (GitHub docs):

File Purpose
CODE_OF_CONDUCT.md Contributor Covenant 3.0
CONTRIBUTING.md How to propose a change
SECURITY.md How to report a vulnerability privately
SUPPORT.md Where questions go
ISSUE_TEMPLATE/ Bug, feature and question forms
pull_request_template.md The pull request checklist

These files, plus LICENSE, .envrc, .editorconfig and .devcontainer/devcontainer.json, are generated by repo-kit. Never edit them here. The text is shared with ismailkattakath/.github, so change it in repo-kit, then:

nix flake update repo-kit
nix run .#write-files
nix flake check   # fails if any file differs from what repo-kit generates

The design is ADR-016 in kattakath/nix-config.

Contributing

See .github/CONTRIBUTING.md. A change to the shared community text belongs in repo-kit.

License

MIT.

About

The fleet's shared landing system: one required gate check, reusable CI workflows, rulesets and community defaults.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages