Skip to content

Commit

Permalink
chore: set safe dir and head
Browse files Browse the repository at this point in the history
  • Loading branch information
oflynned committed Feb 19, 2023
1 parent 5ab1138 commit 3f9b441
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,24 @@ const main = async () => {
console.log('process.env.GITHUB_WORKSPACE', process.env.GITHUB_WORKSPACE);
console.log('process.env.GITHUB_HEAD_REF', process.env.GITHUB_HEAD_REF);

const workspace = process.env.GITHUB_WORKSPACE;

if (workspace) {
await runCommand('git', [
'config',
'--global',
'safe.directory',
workspace,
]);
}

const headRef = process.env.GITHUB_HEAD_REF;

if (headRef) {
await runCommand('git', ['checkout', headRef]);
}

await runCommand('git', ['fetch']);
await runCommand('git', ['checkout', process.env.GITHUB_REF as any]);

const tagPrefix = getTagPrefix(tools);
const skipCi = isSkippingCi(tools);
Expand Down

0 comments on commit 3f9b441

Please sign in to comment.