Skip to content

Commit

Permalink
Merge pull request #90 from oflynned/fix/git-not-found-error
Browse files Browse the repository at this point in the history
Fix/git not found error
  • Loading branch information
oflynned authored Feb 19, 2023
2 parents ed956af + 3f9b441 commit 184fec2
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,28 @@ import { Build, bumpBuild, getBuildFromVersion, Version } from './version';
const main = async () => {
await Toolkit.run(async (tools): Promise<void> => {
try {
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']);

const tagPrefix = getTagPrefix(tools);
const skipCi = isSkippingCi(tools);
const buildNumber = getBuildNumber(tools);
Expand All @@ -31,7 +53,7 @@ const main = async () => {

build = bumpBuild(commits ?? [], existingVersion, buildNumber);
} else {
// create version 0.0.1 by default in build.gradle if not exists
// create version 0.0.1 by default in build.gradle if it does not exist
const defaultBuild: Version = {
major: 0,
minor: 0,
Expand Down

0 comments on commit 184fec2

Please sign in to comment.