Skip to content

Commit 84c4053

Browse files
committed
Use a cache ID that includes the flavor
Otherwise, a `build-installers`-flavored artifact could potentially be restored from a `minimal`-flavored cached one, which would be incorrect. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 18233c6 commit 84c4053

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/git.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export async function getViaGit(
6969
const artifactName = `${repo}-${flavor}`
7070

7171
const octokit = new Octokit()
72-
let id: string
72+
let head_sha: string
7373
if (flavor === 'minimal') {
7474
const info = await octokit.actions.listWorkflowRuns({
7575
owner,
@@ -78,16 +78,17 @@ export async function getViaGit(
7878
status: 'success',
7979
per_page: 1
8080
})
81-
id = info.data.workflow_runs[0].head_sha
81+
head_sha = info.data.workflow_runs[0].head_sha
8282
} else {
8383
const info = await octokit.repos.getBranch({
8484
owner,
8585
repo,
8686
branch: 'main'
8787
})
88-
id = info.data.commit.sha
88+
head_sha = info.data.commit.sha
8989
}
90-
core.notice(`Got ID ${id} for ${repo}`)
90+
const id = `${artifactName}-${head_sha}`
91+
core.notice(`Got commit ${head_sha} for ${repo}`)
9192

9293
return {
9394
artifactName,
@@ -109,7 +110,7 @@ export async function getViaGit(
109110
core.startGroup(`Checking out ${repo}`)
110111
child = spawn(
111112
'git.exe',
112-
[`--git-dir=.tmp`, 'worktree', 'add', outputDirectory, id],
113+
[`--git-dir=.tmp`, 'worktree', 'add', outputDirectory, head_sha],
113114
{
114115
env: {
115116
GIT_CONFIG_PARAMETERS

0 commit comments

Comments
 (0)