chore: sanitize test log names before uploading (#1766)

* sanitize test log names before uploading

* sanitize only if needed

* prepare for pr

---------

Co-authored-by: Sasha <118575614+weboko@users.noreply.github.com>
This commit is contained in:
Florin Barbu 2023-12-21 09:54:31 +02:00 committed by GitHub
parent 9014de8aca
commit 6dc3882657
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 0 deletions

View File

@ -91,6 +91,18 @@ jobs:
name: ${{ inputs.test_type }}-debug.log
path: debug.log
- name: Sanitize log filenames
if: failure()
run: |
find packages/tests/log/ -type f | while read fname; do
dir=$(dirname "$fname")
base=$(basename "$fname")
sanitized_base=$(echo $base | tr -d '\"*:<>?|' | sed 's/[\\/\r\n]/_/g' | sed 's/_$//')
if [ "$base" != "$sanitized_base" ]; then
mv "$fname" "$dir/$sanitized_base"
fi
done
- name: Upload logs on failure
uses: actions/upload-artifact@v3
if: failure()