Skip to content

Commit c297b5a

Browse files
authored
symbolic-ref
1 parent 6ea070e commit c297b5a

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/main.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,17 +70,18 @@ if (exitCode) {
7070
? core.getBooleanInput("push-force")
7171
: null;
7272
if (!pushRefspec) {
73-
const { stdout } = await $({
73+
const { exitCode } = await $({
7474
cwd: rootPath,
75-
})`git rev-parse --abbrev-ref HEAD`;
76-
if (stdout === "HEAD") {
75+
reject: false
76+
})`git symbolic-ref HEAD`;
77+
if (exitCode) {
78+
pushRefspec = stdout;
79+
} else {
7780
const { stdout } = await $({ cwd: rootPath })`git tag --points-at HEAD`;
7881
const tags = stdout.split(/\r?\n/g);
7982
console.assert(tags.length === 1, `tags=${tags} longer than 1`);
8083
pushRefspec = tags[0];
8184
console.assert(pushForce, "push-force: false never updates tag");
82-
} else {
83-
pushRefspec = stdout;
8485
}
8586
}
8687
if (pushForce == null) {

0 commit comments

Comments
 (0)