diff --git a/.github/actions/pytest-summary/action.yml b/.github/actions/pytest-summary/action.yml index 6f529d36496..da23384cd3f 100644 --- a/.github/actions/pytest-summary/action.yml +++ b/.github/actions/pytest-summary/action.yml @@ -32,22 +32,37 @@ runs: with: path: "artifacts" + - name: "Check if artifacts directory has files" + shell: bash + run: | + if [ "$(find artifacts -type f | wc -l)" -gt 0 ]; then + echo "artifacts directory has files" + echo "HAS_FILES=true" >> $GITHUB_ENV + else + echo "::notice:: 'artifacts' directory has NO files. Skipping rest of the steps." + echo "HAS_FILES=false" >> $GITHUB_ENV + fi + - name: "List directories" shell: bash + if: ${{ env.HAS_FILES == 'true' }} run: | echo "::group:: List directories:" && ls -Rla artifacts && echo "::endgroup::" - name: "Uncompress files" + if: ${{ env.HAS_FILES == 'true' }} shell: bash run: | find . -mindepth 1 -maxdepth 4 -type f -name 'logs-*.tgz' -exec tar -xzvf {} -C $(dirname {}) \; - name: "List directories" + if: ${{ env.HAS_FILES == 'true' }} shell: bash run: | echo "::group:: List directories:" && ls -Rla . && echo "::endgroup::" - name: "Create summary" + if: ${{ env.HAS_FILES == 'true' }} shell: bash run: | echo "# Test summary 🚀" >> $GITHUB_STEP_SUMMARY @@ -57,6 +72,7 @@ runs: cat summary.md - name: "Upload tests summary" + if: ${{ env.HAS_FILES == 'true' }} uses: actions/upload-artifact@v4 with: name: tests_durations.json diff --git a/doc/changelog.d/3851.fixed.md b/doc/changelog.d/3851.fixed.md new file mode 100644 index 00000000000..4dccc1dc9dc --- /dev/null +++ b/doc/changelog.d/3851.fixed.md @@ -0,0 +1 @@ +fix: add check for artifacts directory before processing files \ No newline at end of file