Skip to content

Commit

Permalink
Merge pull request #870 from dscho/do-use-expected-sha
Browse files Browse the repository at this point in the history
minimal-sdk: do use the desired `git-sdk-64` revision
  • Loading branch information
dscho authored May 12, 2024
2 parents 4616760 + 1d32499 commit e892757
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 5 deletions.
25 changes: 23 additions & 2 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

30 changes: 28 additions & 2 deletions src/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,32 @@ async function clone(
if (code === 0) {
resolve()
} else {
reject(new Error(`tar: exited with code ${code}`))
reject(new Error(`git clone: exited with code ${code}`))
}
})
})
}

async function updateHEAD(
bareRepositoryPath: string,
headSHA: string
): Promise<void> {
const child = spawn(
gitExePath,
['--git-dir', bareRepositoryPath, 'update-ref', 'HEAD', headSHA],
{
env: {
GIT_CONFIG_PARAMETERS
},
stdio: [undefined, 'inherit', 'inherit']
}
)
return new Promise<void>((resolve, reject) => {
child.on('close', code => {
if (code === 0) {
resolve()
} else {
reject(new Error(`git: exited with code ${code}`))
}
})
})
Expand Down Expand Up @@ -126,7 +151,7 @@ export async function getViaGit(
})
head_sha = info.data.commit.sha
}
const id = `${artifactName}-${head_sha}`
const id = `${artifactName}-${head_sha}${head_sha === 'e37e3f44c1934f0f263dabbf4ed50a3cfb6eaf71' ? '-2' : ''}`
core.info(`Got commit ${head_sha} for ${repo}`)

return {
Expand Down Expand Up @@ -158,6 +183,7 @@ export async function getViaGit(
}
)
} else {
await updateHEAD('.tmp', head_sha)
core.startGroup('Cloning build-extra')
await clone(
`https://github.com/${owner}/build-extra`,
Expand Down

0 comments on commit e892757

Please sign in to comment.