-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathget-condition-vars.js
More file actions
30 lines (25 loc) · 887 Bytes
/
get-condition-vars.js
File metadata and controls
30 lines (25 loc) · 887 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/* eslint-disable import/no-commonjs */
module.exports = core => {
const {
IS_NON_COMMIT_ARG,
ENABLE_CACHE_ARG,
RUN_ID_ARG,
CACHE_DOWNLOAD_FAILED
} = process.env
try {
const isRunIdExists = !!RUN_ID_ARG
const skipGitClone =
IS_NON_COMMIT_ARG === 'true' &&
ENABLE_CACHE_ARG === 'true' &&
isRunIdExists
core.exportVariable('IS_NON_COMMIT_EVENT', IS_NON_COMMIT_ARG)
core.exportVariable('SKIP_GIT_CLONE', skipGitClone.toString())
const shouldCheckout = !skipGitClone || CACHE_DOWNLOAD_FAILED === 'true'
core.exportVariable('SHOULD_CHECKOUT', shouldCheckout.toString())
} catch (error) {
core.warn(`Failed to get condition variables: ${error.message}`)
core.exportVariable('IS_NON_COMMIT_EVENT', 'false')
core.exportVariable('SKIP_GIT_CLONE', 'false')
core.exportVariable('SHOULD_CHECKOUT', 'true')
}
}