Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/rulesets/01-develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,9 @@ rules:

- type: "required_linear_history"
parameters: {}

# Allow organization admins to bypass the PR review requirement (but keep other protections).
bypass_actors:
- actor_id: 1
actor_type: "OrganizationAdmin"
bypass_mode: "pull_request"
6 changes: 6 additions & 0 deletions .github/rulesets/02-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,9 @@ rules:

- type: "required_linear_history"
parameters: {}

# Allow organization admins to bypass the PR review requirement (but keep other protections).
bypass_actors:
- actor_id: 1
actor_type: "OrganizationAdmin"
bypass_mode: "pull_request"
17 changes: 0 additions & 17 deletions .github/rulesets/03-release-hotfix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,3 @@ rules:

- type: "deletion"
parameters: {}

- type: "pull_request"
parameters:
required_approving_review_count: 1
dismiss_stale_reviews_on_push: true
require_code_owner_review: false
require_last_push_approval: false
required_review_thread_resolution: false

- type: "required_status_checks"
parameters:
strict_required_status_checks_policy: true
required_status_checks:
- context: "Required Checks / Gate"

- type: "required_linear_history"
parameters: {}
28 changes: 19 additions & 9 deletions .github/workflows/create-release-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@ jobs:
id: create
uses: actions/github-script@v8
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
github-token: ${{ secrets.REPO_ADMIN_TOKEN != '' && secrets.REPO_ADMIN_TOKEN || github.token }}
script: |
const version = (context.payload.inputs?.version || '').trim();
const rawVersion = (context.payload.inputs?.version || '').trim();
const version = rawVersion.replace(/^v/i, '');
const baseBranch = (context.payload.inputs?.base_branch || 'develop').trim();
const targetBranch = (context.payload.inputs?.target_branch || 'main').trim();
const draft = String(context.payload.inputs?.draft || 'false').toLowerCase() === 'true';
Expand All @@ -57,7 +58,7 @@ jobs:
: [];

if (!/^\d+\.\d+\.\d+$/.test(version)) {
core.setFailed(`Invalid version '${version}'. Expected SemVer like 1.2.3`);
core.setFailed(`Invalid version '${rawVersion}'. Expected SemVer like 1.2.3 (optional leading 'v' allowed)`);
return;
}

Expand Down Expand Up @@ -96,12 +97,21 @@ jobs:
if (!branchExists) {
const sha = base.data.commit.sha;
core.info(`Creating ${releaseBranch} at ${sha}`);
await github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: `refs/heads/${releaseBranch}`,
sha,
});
try {
await github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: `refs/heads/${releaseBranch}`,
sha,
});
} catch (error) {
const status = error?.status;
const msg = error?.message || String(error);
core.setFailed(
`Failed to create branch '${releaseBranch}'. This is usually caused by rulesets/branch protections blocking ref creation or missing token permissions. (HTTP ${status ?? 'unknown'}) ${msg}`
);
return;
}
}

// 3) Reuse existing open PR if present
Expand Down
Loading