fix: use rev-parse instead of branch --show-current for older git compat (#303)

This commit is contained in:
Sascha Bratton
2026-04-10 17:44:48 -04:00
committed by GitHub
parent 61f87a10cd
commit f3ceefdc7e
2 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -363,8 +363,8 @@ exports.listAllFilesAsAdded = listAllFilesAsAdded;
async function getCurrentRef() {
core.startGroup(`Get current git ref`);
try {
const branch = (await (0, exec_1.getExecOutput)('git', ['branch', '--show-current'])).stdout.trim();
if (branch) {
const branch = (await (0, exec_1.getExecOutput)('git', ['rev-parse', '--abbrev-ref', 'HEAD'])).stdout.trim();
if (branch && branch !== 'HEAD') {
return branch;
}
const describe = await (0, exec_1.getExecOutput)('git', ['describe', '--tags', '--exact-match'], { ignoreReturnCode: true });
+2 -2
View File
@@ -166,8 +166,8 @@ export async function listAllFilesAsAdded(): Promise<File[]> {
export async function getCurrentRef(): Promise<string> {
core.startGroup(`Get current git ref`)
try {
const branch = (await getExecOutput('git', ['branch', '--show-current'])).stdout.trim()
if (branch) {
const branch = (await getExecOutput('git', ['rev-parse', '--abbrev-ref', 'HEAD'])).stdout.trim()
if (branch && branch !== 'HEAD') {
return branch
}