Skip to content

Commit

Permalink
LINBEE-10093 - distinct between org and repo levels when download art…
Browse files Browse the repository at this point in the history
…ifact
  • Loading branch information
Yeela Lifshitz authored and Yeela Lifshitz committed Aug 21, 2024
1 parent 56a52c9 commit 47d631b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
15 changes: 14 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,21 @@ runs:
require('${{ github.action_path }}/scripts/get-condition-vars.js')(core);
- name: Download cache artifact
id: download-cache-for-cm-repo
uses: actions/download-artifact@v4
if: ${{ env.SKIP_GIT_CLONE == 'true' && fromJSON(fromJSON(inputs.client_payload)).hasCmRepo == true }}
continue-on-error: true
with:
github-token: ${{ fromJSON(fromJSON(inputs.client_payload)).githubToken || github.token }}
repository: repository: '${{ fromJSON(fromJSON(inputs.client_payload)).owner }}/${{ fromJSON(fromJSON(inputs.client_payload)).cmRepo }}'
run-id: ${{ fromJSON(fromJSON(inputs.client_payload)).artifactRunId }}
name: output
path: code/output

- name: Download cache artifact when cmRepo is false
id: download-cache
uses: actions/download-artifact@v4
if: ${{ env.SKIP_GIT_CLONE == 'true' }}
if: ${{ env.SKIP_GIT_CLONE == 'true' && fromJSON(fromJSON(inputs.client_payload)).hasCmRepo == false}}
continue-on-error: true
with:
github-token: ${{ fromJSON(fromJSON(inputs.client_payload)).githubToken || github.token }}
Expand All @@ -109,6 +121,7 @@ runs:
uses: actions/github-script@v7
env:
ARTIFACT_OUTCOME_ARG: ${{ steps.download-cache.outcome }}
ARTIFACT_OUTCOME_CM_REPO_ARG: ${{ steps.download-cache-for-cm-repo.outcome }}
with:
script: require('${{ github.action_path }}/scripts/check-cache-download-status')(core);

Expand Down
7 changes: 4 additions & 3 deletions scripts/check-cache-download-status.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

module.exports = core => {
try {
const { ARTIFACT_OUTCOME_ARG } = process.env
core.info(`Setting cache download status to: ${ARTIFACT_OUTCOME_ARG}`)
const { ARTIFACT_OUTCOME_ARG, ARTIFACT_OUTCOME_CM_REPO_ARG } = process.env
core.info(`ARTIFACT_OUTCOME_ARG Cache download status: ${ARTIFACT_OUTCOME_ARG}.`)
core.info(`ARTIFACT_OUTCOME_CM_REPO_ARG Cache download status: ${ARTIFACT_OUTCOME_CM_REPO_ARG}.`)

if (ARTIFACT_OUTCOME_ARG === 'failure') {
if (ARTIFACT_OUTCOME_ARG === 'failure' || ARTIFACT_OUTCOME_CM_REPO_ARG === 'failure') {
core.exportVariable('CACHE_DOWNLOAD_FAILED', 'true')
} else {
core.exportVariable('CACHE_DOWNLOAD_FAILED', 'false')
Expand Down

0 comments on commit 47d631b

Please sign in to comment.