morningman opened a new pull request, #4713:
URL: https://github.com/apache/doris-website/pull/4713

   ## Summary
   
   Adds a repository ruleset that blocks **deletion** of the `asf-site` branch.
   
   `asf-site` currently has no protection (`protected: false`), so any user 
with write access can delete it, taking the published site down until the next 
deploy recreates the branch.
   
   ## Why only the deletion rule
   
   The deploy pushes `asf-site` with `peaceiris/actions-gh-pages` and 
`force_orphan: true`, i.e. a force-push. A `non_fast_forward` rule would 
therefore break publishing, so this ruleset enables `restrict_deletion` and 
explicitly disables `restrict_force_push`.
   
   This is deliberate: the rule prevents branch deletion and does **not** block 
the deploy's force-update.
   
   ## What this protects and what it does not
   
   - **Protects**: `asf-site` cannot be deleted by anyone, including a 
compromised writer token.
   - **Does not protect**: a writer can still push or force-push content to 
`asf-site` and change the published site until the next deploy. Blocking that 
requires excluding the deploy identity from a `non_fast_forward` rule.
   
   ## Why not add the force-push rule here
   
   The deploy authenticates with the built-in `GITHUB_TOKEN`, which is the 
platform-native `github-actions` app (ID 15368). GitHub does not allow that app 
as a ruleset bypass actor: the Rulesets API rejects `actor_type: Integration` 
with `actor_id: 15368`, and the app does not appear in the UI bypass picker. A 
`non_fast_forward` rule would therefore block the deploy itself.
   
   ## Follow-up for full protection
   
   1. Create a custom GitHub App with `Contents: write`, installed on 
`apache/doris-website` (org owner / Infra).
   2. Store its app ID and private key as secrets.
   3. Change the deploy jobs in `cron-deploy-website.yml` and 
`manual-deploy-website.yml` to mint a token with 
`actions/create-github-app-token` and pass it to `peaceiris/actions-gh-pages` 
instead of `github.token`.
   4. Extend this ruleset with `non_fast_forward` (and optionally `update`) and 
add the app as a bypass actor, using the raw ruleset payload syntax:
   
      ```yaml
      bypass_actors:
        - actor_id: <app-id>
          actor_type: Integration
          bypass_mode: always
      ```
   
   5. A deploy key is an alternative (`actor_type: DeployKey`), simpler but 
adds another long-lived credential.
   
   Until that follow-up, this PR is a safe, non-breaking first step.
   
   ## Validation
   
   - `.asf.yaml` parses as valid YAML; the ruleset uses the asfyaml convenience 
syntax (`type: branch`, `branches.includes`, `restrict_deletion`, 
`restrict_force_push`).
   - `restrict_force_push: false` is explicitly set because the convenience 
syntax defaults it to `true`.
   - After merge, ASF Infra's asfyaml run creates the ruleset; verify with `GET 
/repos/apache/doris-website/rulesets` and run a deploy to confirm publishing 
still works.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to