Skip to content

Commit

Permalink
see if this works
Browse files Browse the repository at this point in the history
  • Loading branch information
jcbhmr committed Nov 16, 2023
1 parent e871b1e commit 45c7d65
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,19 @@ tag: {
// git show-ref | grep $(git rev-parse HEAD)
const showRef = await $({ cwd: rootPath })`git show-ref`
const revParse = await $({ cwd: rootPath })`git rev-parse HEAD`
const refLine = showRef.stdout.split(/\r?\n/g).find(x => x.includes(revParse.stdout))
if (!refLine) {
const refLines = showRef.stdout.split(/\r?\n/g).filter(x => x.includes(revParse.stdout))
if (!refLines.length) {
break tag;
}
const refName = refLine.split(" ").at(-1)!
const match = refName.match(/^refs\/tags\/(.+)/)
if (match) {
tagTagname = match[1]
} else {
for (const refLine of refLines) {
const refName = refLine.split(" ").at(-1)!
const match = refName.match(/^refs\/tags\/(.+)/)
if (match) {
tagTagname = match[1]
break;
}
}
if (!tagTagname) {
break tag;
}
}
Expand All @@ -147,6 +151,13 @@ push: {
if (tagTagname) {
pushRefspec = tagTagname
}

const { stdout } = await $({ cwd: rootPath })`git rev-parse --abbrev-ref HEAD`
if (stdout === "HEAD") {
throw new DOMException("no branch detectable")
} else {
pushRefspec = stdout
}
}

let pushForce = core.getInput("push-force") ? core.getBooleanInput("push-force") : null;
Expand Down

0 comments on commit 45c7d65

Please sign in to comment.