diff --git a/scripts/modules/createCommit.js b/scripts/modules/createCommit.js index 9091df79..ec63e094 100644 --- a/scripts/modules/createCommit.js +++ b/scripts/modules/createCommit.js @@ -14,7 +14,7 @@ export default async (message) => { return false; } if (!upstream) { - console.info("Running in github actions, but HEAD is not tracking any remote branch, exit."); + console.info("Running in github actions, but HEAD does not point to a branch, exit."); return false; } console.info("[createCommit] Running in github actions, try to create commit."); diff --git a/scripts/modules/getUpstream.js b/scripts/modules/getUpstream.js index b18ed62d..c9ee8499 100644 --- a/scripts/modules/getUpstream.js +++ b/scripts/modules/getUpstream.js @@ -6,13 +6,18 @@ if (!isInGithubActions) { process.exit(0); } /** - * @type { string | false } when false, it means the current branch is not tracking any remote branch. + * @type { string | false } when false, it means the current branch does not point to a branch. */ let result; try { result = await git.revparse(["--abbrev-ref", "--symbolic-full-name", "@{upstream}"]); + console.info("[getUpstream]", "upstream:", result); } catch (e) { - console.error(e); + if (e?.message?.includes("HEAD does not point to a branch")) { + console.info("[getUpstream]", "HEAD does not point to a branch."); + } else { + console.error("[getUpstream]", "Unexpected error:", e); + } result = false; } export default result; diff --git a/scripts/postCommit/push.js b/scripts/postCommit/push.js index 672be2ba..1fb61979 100644 --- a/scripts/postCommit/push.js +++ b/scripts/postCommit/push.js @@ -10,7 +10,7 @@ if (!isInGithubActions) { process.exit(0); } if (!upstream) { - console.info("Running in github actions, but HEAD is not tracking any remote branch, exit."); + console.info("Running in github actions, but HEAD does not point to a branch, exit."); process.exit(0); } const GITHUB_EVENT = await readWorkflowEvent();