@@ -24,14 +24,22 @@ runs:
2424 using : " composite"
2525 steps :
2626 - id : prepare-download
27- shell : bash
28- run : |
29- # Forge the unique artifact name for the current workflow
30- ARTIFACT_NAME="${{ github.run_id }}-${{ github.run_number }}-${{ inputs.artifact-name }}"
31- echo "artifact-name=$ARTIFACT_NAME" >> "$GITHUB_OUTPUT"
27+ uses : actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
28+ env :
29+ ARTIFACT_NAME_INPUT : ${{ inputs.artifact-name }}
30+ with :
31+ script : |
32+ const path = require('node:path');
33+ const runId = process.env.GITHUB_RUN_ID ?? '';
34+ const runNumber = process.env.GITHUB_RUN_NUMBER ?? '';
35+ const artifactNameInput = process.env.ARTIFACT_NAME_INPUT ?? '';
36+
37+ // Forge the unique artifact name for the current workflow
38+ const artifactName = `${runId}-${runNumber}-${artifactNameInput}`;
39+ core.setOutput('artifact-name', artifactName);
3240
33- ARTIFACT_PATH="/tmp/$ARTIFACT_NAME"
34- echo " artifact-path=$ARTIFACT_PATH" >> "$GITHUB_OUTPUT"
41+ const artifactPath = path.join(process.env.RUNNER_TEMP, artifactName);
42+ core.setOutput(' artifact-path', artifactPath);
3543
3644 - uses : actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
3745 with :
@@ -41,11 +49,14 @@ runs:
4149
4250 - id : read-artifacts
4351 uses : actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
52+ env :
53+ ARTIFACT_PATH : ${{ steps.prepare-download.outputs.artifact-path }}
54+ REMOVE_ARTIFACT : ${{ inputs.remove-artifact }}
4455 with :
4556 script : |
4657 const { readFileSync } = require('fs');
4758
48- const artifactPath = `${{ steps.prepare-download.outputs.artifact-path }}` ;
59+ const artifactPath = process.env.ARTIFACT_PATH ;
4960 const globber = await glob.create(`${artifactPath}/*.json`, {followSymbolicLinks: false});
5061 const artifactFiles = await globber.glob();
5162
5869
5970 core.setOutput('artifacts',`[${result}]`);
6071
61- const shouldRemoveArtifact = `${{ inputs.remove-artifact }}` === 'true';
72+ const shouldRemoveArtifact = (process.env.REMOVE_ARTIFACT || '').toLowerCase() === 'true';
6273 if(shouldRemoveArtifact) {
6374 await io.rmRF(artifactPath);
6475 }
0 commit comments