From 6dc38826570b48906c94d4a6e0ad18686d48c8ac Mon Sep 17 00:00:00 2001 From: Florin Barbu Date: Thu, 21 Dec 2023 09:54:31 +0200 Subject: [PATCH] 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> --- .github/workflows/test-node.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/test-node.yml b/.github/workflows/test-node.yml index 6ac8e6fdf2..c123a83939 100644 --- a/.github/workflows/test-node.yml +++ b/.github/workflows/test-node.yml @@ -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()