Skip to content

Commit d7817ac

Browse files
committed
Adds branch detection
1 parent 54109a8 commit d7817ac

3 files changed

Lines changed: 12 additions & 5 deletions

File tree

dist/index.js

Lines changed: 5 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,13 @@ async function run(): Promise<void> {
1919
core.debug('Configured git user.name/user.email')
2020

2121
// Create the oprhan github-meta branch if it doesn't exist
22+
const branch = core.getInput('branch')
23+
const branchExists =
24+
execSync(`git branch --list ${branch}`).toString().trim() !== ''
2225

23-
const output = execSync(`git branch --list main`).toString().trim()
24-
console.log(output === '')
26+
if (!branchExists) {
27+
core.info(`No ${branch} branch exists, creating...`)
28+
}
2529

2630
core.endGroup()
2731
}

0 commit comments

Comments
 (0)