Skip to content

feat: add release-beta-lock action [ED-25903] - #63

Open
davseve wants to merge 2 commits into
mainfrom
feat/ED-25903-release-beta-lock
Open

davseve wants to merge 2 commits into
mainfrom
feat/ED-25903-release-beta-lock

Conversation

@davseve

@davseve davseve commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds a release-beta-lock composite action that core and Pro can use to lock or unlock release/beta for merges as part of the release cycle.

  • state: locked turns on a dedicated repository ruleset named Release beta lock. Its only rule is update, so nobody without bypass permission can push or merge into the branch.
  • state: unlocked turns that ruleset off.
  • The ruleset is created on the first run. The existing "main and releases" ruleset is not touched.
  • API failures emit an ::error annotation that names the failed operation and fail the step, so a missing lock is never silent.

Planned callers (core PR follows this one):

  • Unlock: at branch-out (create-version-change.yml), before any branch work.
  • Lock: after publishing the first stable release of a minor (X.Y.0) in controlled-release.yml.

This lines up with sync-release-branches: once stable reaches the beta's X.Y, branch sync already treats beta as inactive.

Token

Managing rulesets needs repository Administration: write, which GITHUB_TOKEN can't be granted. Callers pass MAINTAIN_TOKEN for now, so its owner must be a repo admin.

Follow-up: replace MAINTAIN_TOKEN with a GitHub App token (actions/create-github-app-token) installed on core and Pro. That way the lock isn't tied to a personal account, and the app can be added as a bypass actor if needed.

Test plan

  • bash actions/release-beta-lock/release-beta-lock.test.sh: 16 tests with a stubbed gh (create, update, invalid state, list/update failures)
  • Ruleset lookup (env.RULESET_NAME in --jq) checked against the real elementor/elementor rulesets API
  • prettier --check
  • First real run from a core workflow

Jira

ED-25903

Made with Cursor

✨ PR Description

1. Problem & Context

Implements a GitHub Action (ED-25903) to programmatically lock or unlock the beta release branch using repository rulesets to prevent unauthorized merges.

2. What Changed (Where)

  • actions/release-beta-lock/release-beta-lock.sh: Bash script to manage ruleset enforcement via GH API.
  • actions/release-beta-lock/action.yml: Composite action definition with inputs for token, state, and branch.
  • actions/release-beta-lock/package.json: Metadata and test script definition.
  • actions/release-beta-lock/release-beta-lock.test.sh: Comprehensive test suite mocking GH API calls.

3. How It Works

The action takes a target state (locked/unlocked) and branch, then checks for an existing repository ruleset by name. If found, it updates the enforcement status via PUT; otherwise, it creates a new ruleset via POST with an "update" rule targeting the specified branch.

4. Risks

Requires a PAT or GitHub App token with Administrative write permissions, as the default GITHUB_TOKEN cannot modify repository rulesets.

Generated by LinearB AI and added by gitStream.
AI-generated content may contain inaccuracies. Please verify before using.
💡 Tip: You can customize your AI Description using Guidelines Learn how

Lock or unlock release/beta for merges by toggling a dedicated
"Release beta lock" ruleset that holds an "update" rule. The ruleset is
created on first run. API failures emit an error annotation and fail the step.

Ref: ED-25903
Co-authored-by: Cursor <cursoragent@cursor.com>
Comment thread actions/release-beta-lock/action.yml Fixed
- Fix lockfile: regenerate package-lock.json with npm install to include @elementor/release-beta-lock
- Fix CodeQL code injection: pass github.action_path through env var instead of inline interpolation
- Fix SIGPIPE: capture gh output first, then take first line to avoid pipeline failure
- Fix org-level rulesets: filter for source_type == 'Repository' to exclude org rulesets
- Fix test isolation: run tests in clean subshells, prevent global variable leakage
- Add new tests: default branch, missing repo, disabled enforcement, org filtering, duplicates
- Fix error propagation: explicitly return gh failure code in find_ruleset_id

All tests pass locally. Resolves review items 1-5.

Co-authored-by: Davids Seveloff <davseve@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants