Skip to content

Commit 3d00da4

Browse files
committed
feat(action): add support for dry-run / --dry-run
1 parent a46ce50 commit 3d00da4

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

action-template/action.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,14 @@ function main() {
5151
args.push("--branch-from", branchFrom);
5252
}
5353

54+
const dryrun = process.env["INPUT_DRY-RUN"] || "false"
55+
if(!["true", "false"].includes(dryrun.toLowerCase())) {
56+
console.error(`Invalid value for dry-run (${dryrun}). Must be one of true or false.`);
57+
process.exit(1);
58+
}
59+
60+
if(dryrun.toLowerCase() === "true") { args.push("--dry-run") }
61+
5462
if (command === "push") {
5563
args.push(...process.env.INPUT_COMMITS.split(/\s+/));
5664
} else {

action-template/action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ inputs:
2424
command:
2525
description: 'Command to run. One of "commit" or "push"'
2626
required: true
27+
dry-run:
28+
description: 'Stop processing just before actually making changes to the remote. Note that the pushed_ref output will be a zeroed commit hash.'
29+
default: false
2730
commits:
2831
description: 'For push, the list of commit hashes to push, oldest first'
2932
files:

0 commit comments

Comments
 (0)