4242 - name : Create GitStream folder
4343 shell : bash
4444 run : |
45- rm -rf gitstream && mkdir gitstream
45+ rm -rf gitstream && rm -rf code && mkdir gitstream
4646 cd gitstream && mkdir repo
4747
4848 - name : Checkout base branch
8383 process.exit(1);
8484 }
8585
86+ - name : Get condition variables
87+ uses : actions/github-script@v7
88+ env :
89+ IS_NON_COMMIT_ARG : ${{ fromJSON(fromJSON(inputs.client_payload)).isNonCommitEvent }}
90+ ENABLE_CACHE_ARG : ${{ env.ENABLE_CACHE }}
91+ RUN_ID_ARG : ${{ fromJSON(fromJSON(inputs.client_payload)).artifactRunId }}
92+ with :
93+ script : |
94+ require('${{ github.action_path }}/scripts/get-condition-vars.js')(core);
95+
96+ - name : Download cache artifact for cm repo
97+ id : download-cache-for-cm-repo
98+ uses : actions/download-artifact@v4
99+ if : ${{ env.SKIP_GIT_CLONE == 'true' && fromJSON(fromJSON(inputs.client_payload)).hasCmRepo == true }}
100+ continue-on-error : true
101+ with :
102+ github-token : ${{ fromJSON(fromJSON(inputs.client_payload)).githubToken || github.token }}
103+ repository : ' ${{ fromJSON(fromJSON(inputs.client_payload)).owner }}/${{ fromJSON(fromJSON(inputs.client_payload)).cmRepo }}'
104+ run-id : ${{ fromJSON(fromJSON(inputs.client_payload)).artifactRunId }}
105+ name : output
106+ path : code/output
107+
108+ - name : Download cache artifact when cmRepo is false
109+ id : download-cache
110+ uses : actions/download-artifact@v4
111+ if : ${{ env.SKIP_GIT_CLONE == 'true' && fromJSON(fromJSON(inputs.client_payload)).hasCmRepo == false}}
112+ continue-on-error : true
113+ with :
114+ github-token : ${{ fromJSON(fromJSON(inputs.client_payload)).githubToken || github.token }}
115+ repository : ${{ inputs.full_repository }}
116+ run-id : ${{ fromJSON(fromJSON(inputs.client_payload)).artifactRunId }}
117+ name : output
118+ path : code/output
119+
120+ - name : Check if download cache artifact failed
121+ uses : actions/github-script@v7
122+ env :
123+ ARTIFACT_OUTCOME_ARG : ${{ steps.download-cache.outcome }}
124+ ARTIFACT_OUTCOME_CM_REPO_ARG : ${{ steps.download-cache-for-cm-repo.outcome }}
125+ with :
126+ script : require('${{ github.action_path }}/scripts/check-cache-download-status')(core);
127+
86128 - name : Checkout Pull Request branches history
129+ if : ${{ env.SKIP_GIT_CLONE == 'false' || env.CACHE_DOWNLOAD_FAILED == 'true' }}
87130 shell : bash
88131 run : |
89132 ALL=1
@@ -96,12 +139,13 @@ runs:
96139 git checkout $'${{ steps.safe-strings.outputs.head_ref }}'
97140
98141 - name : Create cm folder
142+ if : ${{ env.SKIP_GIT_CLONE == 'false' || env.CACHE_DOWNLOAD_FAILED == 'true' }}
99143 shell : bash
100144 run : cd gitstream && mkdir cm
101145
102146 - name : Checkout cm repo
103147 uses : actions/checkout@v4
104- if : ${{ fromJSON(fromJSON(inputs.client_payload)).hasCmRepo == true }}
148+ if : ${{ fromJSON(fromJSON(inputs.client_payload)).hasCmRepo == true && (env.SKIP_GIT_CLONE == 'false' || env.CACHE_DOWNLOAD_FAILED == 'true') }}
105149 with :
106150 repository : ' ${{ fromJSON(fromJSON(inputs.client_payload)).owner }}/${{ fromJSON(fromJSON(inputs.client_payload)).cmRepo }}'
107151 ref : ${{ fromJSON(fromJSON(inputs.client_payload)).cmRepoRef }}
@@ -113,7 +157,7 @@ runs:
113157
114158 - name : Install Dependencies for plugins
115159 shell : bash
116- run : npm i --silent moment lodash axios @octokit/rest
160+ run : npm i --silent moment lodash axios @octokit/rest@20.1.1
117161
118162 - name : Run RulesEngine
119163 shell : bash
@@ -125,3 +169,15 @@ runs:
125169 RULES_RESOLVER_URL : ${{ inputs.resolver_url }}
126170 RULES_RESOLVER_TOKEN : ${{ inputs.resolver_token }}
127171 DEBUG_MODE : ${{ inputs.debug_mode }}
172+ SHOULD_SKIP_CLONE : ${{ env.SKIP_GIT_CLONE == 'true' && env.CACHE_DOWNLOAD_FAILED == 'false'}}
173+ ENABLE_CACHE : ${{ env.ENABLE_CACHE }}
174+ ENABLE_DEBUG_ARTIFACTS : ${{ env.ENABLE_DEBUG_ARTIFACTS }}
175+ RUN_ID : ${{ github.run_id }}
176+
177+ - name : Upload artifacts
178+ if : ${{ env.ENABLE_DEBUG_ARTIFACTS == 'true' || env.ENABLE_CACHE == 'true' }}
179+ uses : actions/upload-artifact@v4
180+ with :
181+ retention-days : 7
182+ name : output
183+ path : code/output
0 commit comments