Skip to content

Commit 969bed3

Browse files
authored
Sanitize the github workflow (#157)
1 parent 470eeab commit 969bed3

1 file changed

Lines changed: 18 additions & 5 deletions

File tree

.github/workflows/ci.yml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,29 @@ jobs:
5656
echo ${CCACHE_BASEDIR}
5757
ccache -s
5858
fi
59+
60+
- name: Sanitize artifact name
61+
id: sanitize
62+
# This step removes special characters from the artifact name to ensure compatibility with upload-artifact
63+
# Characters removed: " : < > | * ? \r \n \ /
64+
# Spaces are replaced with underscores
65+
# This sanitization prevents errors in artifact creation and retrieval
66+
shell: pwsh
67+
run: |
68+
$originalName = "BeamAdapter_${{ steps.sofa.outputs.run_branch }}_for-SOFA-${{ steps.sofa.outputs.sofa_version }}_${{ runner.os }}"
69+
$artifact_name = $originalName -replace '[":;<>|*?\r\n\\/]', '' -replace ' ', '_'
70+
echo "artifact_name=$artifact_name" >> $env:GITHUB_OUTPUT
71+
5972
- name: Create artifact
60-
uses: actions/upload-artifact@v2
73+
uses: actions/upload-artifact@v4.4.0
6174
with:
62-
name: BeamAdapter_${{ steps.sofa.outputs.run_branch }}_for-SOFA-${{ steps.sofa.outputs.sofa_version }}_${{ runner.os }}
75+
name: ${{ steps.sanitize.outputs.artifact_name }}
6376
path: ${{ env.WORKSPACE_INSTALL_PATH }}
6477

6578
- name: Install artifact
66-
uses: actions/download-artifact@v2
79+
uses: actions/download-artifact@v4.1.7
6780
with:
68-
name: BeamAdapter_${{ steps.sofa.outputs.run_branch }}_for-SOFA-${{ steps.sofa.outputs.sofa_version }}_${{ runner.os }}
81+
name: ${{ steps.sanitize.outputs.artifact_name }}
6982
path: ${{ env.WORKSPACE_ARTIFACT_PATH }}
7083

7184
- name: Set env vars for tests
@@ -140,7 +153,7 @@ jobs:
140153
continue-on-error: true
141154
steps:
142155
- name: Get artifacts
143-
uses: actions/download-artifact@v2
156+
uses: actions/download-artifact@v4.1.7
144157
with:
145158
path: artifacts
146159

0 commit comments

Comments
 (0)