mirror of
https://github.com/actions/runner-container-hooks.git
synced 2025-12-20 06:42:34 +00:00
Expose CI=true and GITHUB_ACTIONS env variables (#215)
* Expose CI=true and GITHUB_ACTIONS env variables * fmt * revert the prettier and finish this * revert package-lock.json
This commit is contained in:
@@ -229,6 +229,18 @@ export function createContainerSpec(
|
||||
}
|
||||
}
|
||||
|
||||
podContainer.env.push({
|
||||
name: 'GITHUB_ACTIONS',
|
||||
value: 'true'
|
||||
})
|
||||
|
||||
if (!('CI' in container['environmentVariables'])) {
|
||||
podContainer.env.push({
|
||||
name: 'CI',
|
||||
value: 'true'
|
||||
})
|
||||
}
|
||||
|
||||
podContainer.volumeMounts = containerVolumes(
|
||||
container.userMountVolumes,
|
||||
jobContainer
|
||||
|
||||
@@ -29,7 +29,14 @@ export async function runContainerStep(
|
||||
let secretName: string | undefined = undefined
|
||||
if (stepContainer.environmentVariables) {
|
||||
try {
|
||||
secretName = await createSecretForEnvs(stepContainer.environmentVariables)
|
||||
const envs = JSON.parse(
|
||||
JSON.stringify(stepContainer.environmentVariables)
|
||||
)
|
||||
envs['GITHUB_ACTIONS'] = 'true'
|
||||
if (!('CI' in envs)) {
|
||||
envs.CI = 'true'
|
||||
}
|
||||
secretName = await createSecretForEnvs(envs)
|
||||
} catch (err) {
|
||||
core.debug(`createSecretForEnvs failed: ${JSON.stringify(err)}`)
|
||||
const message = (err as any)?.response?.body?.message || err
|
||||
|
||||
Reference in New Issue
Block a user