Skip to content

Commit db94ef0

Browse files
feat: allow a branch-suffix in release branch name (#321)
1 parent 03bc3af commit db94ef0

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

create-release-branch/action.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ name: Create release branch
33
inputs:
44
version:
55
required: false
6+
branch-suffix:
7+
required: false
68
live-run:
79
required: true
810
dry-run-history-size:
@@ -14,7 +16,6 @@ inputs:
1416
github-token:
1517
required: true
1618

17-
1819
outputs:
1920
version:
2021
description: Release number

dist/create-release-branch-main.mjs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20002,13 +20002,15 @@ function cloneFromGitHub(repo, options) {
2000220002
var DEFAULT_DRY_RUN_HISTORY_SIZE = 5;
2000320003
function setup() {
2000420004
const version = core2.getInput("version");
20005+
const branchSuffix = core2.getInput("branch-suffix");
2000520006
const liveRun = core2.getBooleanInput("live-run", { required: true });
2000620007
const dryRunHistorySize = core2.getInput("dry-run-history-size", { required: false });
2000720008
const repo = core2.getInput("repo", { required: true });
2000820009
const branch = core2.getInput("branch", { required: false });
2000920010
const githubToken = core2.getInput("github-token", { required: true });
2001020011
return {
2001120012
version: version === "" ? void 0 : version,
20013+
branchSuffix: branchSuffix === "" ? void 0 : branchSuffix,
2001220014
liveRun,
2001320015
repo,
2001420016
branch: branch === "" ? void 0 : branch,
@@ -20025,10 +20027,10 @@ async function main(input) {
2002520027
core2.setOutput("version", version);
2002620028
let branch;
2002720029
if (input.liveRun) {
20028-
branch = `release/${version}`;
20030+
branch = input.branchSuffix != void 0 ? `release/${version}${input.branchSuffix}` : `release/${version}`;
2002920031
core2.setOutput("branch", branch);
2003020032
} else {
20031-
branch = `release/dry-run/${version}`;
20033+
branch = input.branchSuffix != void 0 ? `release/dry-run/${version}${input.branchSuffix}` : `release/dry-run/${version}`;
2003220034
core2.setOutput("branch", branch);
2003320035
const branchPattern = "refs/remotes/origin/release/dry-run";
2003420036
const branchesRaw = sh(`git for-each-ref --format='%(refname:strip=3)' --sort=authordate ${branchPattern}`, {

src/create-release-branch.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,17 @@ const DEFAULT_DRY_RUN_HISTORY_SIZE = 5;
99

1010
export type Input = {
1111
version?: string;
12+
branchSuffix?: string;
1213
liveRun: boolean;
13-
dryRunHistorySize?: number;
14+
dryRunHistorySize: number;
1415
repo: string;
1516
branch?: string;
1617
githubToken: string;
1718
};
1819

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

2729
return {
2830
version: version === "" ? undefined : version,
31+
branchSuffix: branchSuffix === "" ? undefined : branchSuffix,
2932
liveRun,
3033
repo,
3134
branch: branch === "" ? undefined : branch,
@@ -46,10 +49,13 @@ export async function main(input: Input) {
4649

4750
let branch: string;
4851
if (input.liveRun) {
49-
branch = `release/${version}`;
52+
branch = input.branchSuffix != undefined ? `release/${version}${input.branchSuffix}` : `release/${version}`;
5053
core.setOutput("branch", branch);
5154
} else {
52-
branch = `release/dry-run/${version}`;
55+
branch =
56+
input.branchSuffix != undefined
57+
? `release/dry-run/${version}${input.branchSuffix}`
58+
: `release/dry-run/${version}`;
5359
core.setOutput("branch", branch);
5460

5561
const branchPattern = "refs/remotes/origin/release/dry-run";

0 commit comments

Comments
 (0)