Skip to content

Commit e892757

Browse files
authored
Merge pull request #870 from dscho/do-use-expected-sha
minimal-sdk: do use the desired `git-sdk-64` revision
2 parents 4616760 + 1d32499 commit e892757

File tree

3 files changed

+52
-5
lines changed

3 files changed

+52
-5
lines changed

dist/index.js

Lines changed: 23 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/git.ts

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,32 @@ async function clone(
7474
if (code === 0) {
7575
resolve()
7676
} else {
77-
reject(new Error(`tar: exited with code ${code}`))
77+
reject(new Error(`git clone: exited with code ${code}`))
78+
}
79+
})
80+
})
81+
}
82+
83+
async function updateHEAD(
84+
bareRepositoryPath: string,
85+
headSHA: string
86+
): Promise<void> {
87+
const child = spawn(
88+
gitExePath,
89+
['--git-dir', bareRepositoryPath, 'update-ref', 'HEAD', headSHA],
90+
{
91+
env: {
92+
GIT_CONFIG_PARAMETERS
93+
},
94+
stdio: [undefined, 'inherit', 'inherit']
95+
}
96+
)
97+
return new Promise<void>((resolve, reject) => {
98+
child.on('close', code => {
99+
if (code === 0) {
100+
resolve()
101+
} else {
102+
reject(new Error(`git: exited with code ${code}`))
78103
}
79104
})
80105
})
@@ -126,7 +151,7 @@ export async function getViaGit(
126151
})
127152
head_sha = info.data.commit.sha
128153
}
129-
const id = `${artifactName}-${head_sha}`
154+
const id = `${artifactName}-${head_sha}${head_sha === 'e37e3f44c1934f0f263dabbf4ed50a3cfb6eaf71' ? '-2' : ''}`
130155
core.info(`Got commit ${head_sha} for ${repo}`)
131156

132157
return {
@@ -158,6 +183,7 @@ export async function getViaGit(
158183
}
159184
)
160185
} else {
186+
await updateHEAD('.tmp', head_sha)
161187
core.startGroup('Cloning build-extra')
162188
await clone(
163189
`https://github.com/${owner}/build-extra`,

0 commit comments

Comments
 (0)