Skip to content

feat: allow a branch-suffix in release branch name #321

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
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
3 changes: 2 additions & 1 deletion create-release-branch/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name: Create release branch
inputs:
version:
required: false
branch-suffix:
required: false
live-run:
required: true
dry-run-history-size:
Expand All @@ -14,7 +16,6 @@ inputs:
github-token:
required: true


outputs:
version:
description: Release number
Expand Down
6 changes: 4 additions & 2 deletions dist/create-release-branch-main.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20002,13 +20002,15 @@ function cloneFromGitHub(repo, options) {
var DEFAULT_DRY_RUN_HISTORY_SIZE = 5;
function setup() {
const version = core2.getInput("version");
const branchSuffix = core2.getInput("branch-suffix");
const liveRun = core2.getBooleanInput("live-run", { required: true });
const dryRunHistorySize = core2.getInput("dry-run-history-size", { required: false });
const repo = core2.getInput("repo", { required: true });
const branch = core2.getInput("branch", { required: false });
const githubToken = core2.getInput("github-token", { required: true });
return {
version: version === "" ? void 0 : version,
branchSuffix: branchSuffix === "" ? void 0 : branchSuffix,
liveRun,
repo,
branch: branch === "" ? void 0 : branch,
Expand All @@ -20025,10 +20027,10 @@ async function main(input) {
core2.setOutput("version", version);
let branch;
if (input.liveRun) {
branch = `release/${version}`;
branch = input.branchSuffix != void 0 ? `release/${version}${input.branchSuffix}` : `release/${version}`;
core2.setOutput("branch", branch);
} else {
branch = `release/dry-run/${version}`;
branch = input.branchSuffix != void 0 ? `release/dry-run/${version}${input.branchSuffix}` : `release/dry-run/${version}`;
core2.setOutput("branch", branch);
const branchPattern = "refs/remotes/origin/release/dry-run";
const branchesRaw = sh(`git for-each-ref --format='%(refname:strip=3)' --sort=authordate ${branchPattern}`, {
Expand Down
12 changes: 9 additions & 3 deletions src/create-release-branch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,17 @@ const DEFAULT_DRY_RUN_HISTORY_SIZE = 5;

export type Input = {
version?: string;
branchSuffix?: string;
liveRun: boolean;
dryRunHistorySize?: number;
dryRunHistorySize: number;
repo: string;
branch?: string;
githubToken: string;
};

export function setup(): Input {
const version = core.getInput("version");
const branchSuffix = core.getInput("branch-suffix");
const liveRun = core.getBooleanInput("live-run", { required: true });
const dryRunHistorySize = core.getInput("dry-run-history-size", { required: false });
const repo = core.getInput("repo", { required: true });
Expand All @@ -26,6 +28,7 @@ export function setup(): Input {

return {
version: version === "" ? undefined : version,
branchSuffix: branchSuffix === "" ? undefined : branchSuffix,
liveRun,
repo,
branch: branch === "" ? undefined : branch,
Expand All @@ -46,10 +49,13 @@ export async function main(input: Input) {

let branch: string;
if (input.liveRun) {
branch = `release/${version}`;
branch = input.branchSuffix != undefined ? `release/${version}${input.branchSuffix}` : `release/${version}`;
core.setOutput("branch", branch);
} else {
branch = `release/dry-run/${version}`;
branch =
input.branchSuffix != undefined
? `release/dry-run/${version}${input.branchSuffix}`
: `release/dry-run/${version}`;
core.setOutput("branch", branch);

const branchPattern = "refs/remotes/origin/release/dry-run";
Expand Down
Loading