Skip to content

Turn on protection for main (the ProtectMain ruleset is disabled and targets no branch) #175

Closed

Description

@wormeyman

main has no protection in force right now. Anyone with write access can force-push it, delete it, or merge a PR whose CI is red. Merging to main also deploys the live site, so a red merge goes straight to users.

What's there today

Checked 2026-10-21 with gh api:

  • Branch protection: none. GET /repos/FactoryGameFan/FactorioTools/branches/main/protection returns 404 "Branch not protected".
  • Rulesets: one, ProtectMain (id 18139941), created 2026-06-25 and never changed since.
    • Its enforcement is disabled.
    • It has two rules: block deletion, and block force pushes (non_fast_forward).
    • Its target list is empty (conditions.ref_name.include is []). So switching it on as it stands would still protect no branch. It needs ~DEFAULT_BRANCH added.
    • It has no bypass actors.

Proposed fix

  1. Now: edit ProtectMain so it targets ~DEFAULT_BRANCH, and set it to active. Keep the deletion and force-push rules. Target ~DEFAULT_BRANCH rather than ~ALL: a ruleset on ~ALL blocks Renovate from force-pushing its own branches. Renovate's PRs then keep a stale commit, and deleting the branch fails with HTTP 422.
  2. After the Rust port's stage 13b merges (Consider porting the oil-field planner to Rust/WASM #138): add a required_status_checks rule. Stage 13b deletes the .NET and Lua CI jobs, so waiting means the list names only checks that will still exist. The checks that remain afterward are:
    • Build front-end and Rust port (ci.yml)
    • Build and deploy (the deploy workflow's PR build, which never deploys)
  3. Decide whether to require a pull request for every change to main. Most work already goes through PRs, so this mostly stops accidental direct pushes. If it's on, the repo admin may want a bypass for emergencies.

The repo is public, so rulesets are fully enforced on the free plan.

Activity

  1. wormeyman commented on Oct 21, 2026

    @wormeyman
    CollaboratorAuthor

    Step 1 is done (2026-10-21). ProtectMain now targets ~DEFAULT_BRANCH with enforcement active, keeping its two rules (no deletion, no force push). GET /repos/FactoryGameFan/FactorioTools/rules/branches/main now returns both rules from ruleset 18139941.

    Steps 2 (required status checks) and 3 (require a PR) are still open. Step 2 waits until the stage 13b PR of #138 has merged.

  2. wormeyman commented on Oct 21, 2026

    @wormeyman
    CollaboratorAuthor

    Step 2 is done. Stage 13b merged in #177. ProtectMain now also has a required_status_checks rule for Build front-end and Rust port, both from GitHub Actions (integration 15368). It does not require branches to be up to date, so Renovate's rebases are not blocked.

    Build and deploy is not on the list, even though step 2 named it. The deploy workflow's pull_request trigger has a paths filter (rust/**, src/vue/** and the workflow itself), and the devcontainer smoke job has one too. A required check that never starts stays pending, so a docs or config PR could never merge. The two ci.yml checks run on every PR.

    GET /repos/FactoryGameFan/FactorioTools/rules/branches/main now returns deletion, non_fast_forward and required_status_checks.

    Step 3, requiring a PR for every change to main, is still open.

  3. wormeyman commented on Oct 21, 2026

    @wormeyman
    CollaboratorAuthor

    Step 3 is done, so this issue is finished. ProtectMain now has a pull_request rule, which means every change to main goes through a pull request. It asks for 0 approvals, and require_extra_approval_for_unattributed_changes is set to false, so a Renovate PR does not wait for a review. The repository admin role has an "always" bypass for emergencies.

    The ruleset now holds deletion, non_fast_forward, required_status_checks (Build front-end, Rust port) and pull_request, on ~DEFAULT_BRANCH.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions