From 7c6c120d97b33da4bb29b605a37720055821244e Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Wed, 29 May 2024 06:03:23 -0500 Subject: [PATCH] Use a random coverage artifact name if none is given (#237) --- .github/actions/report-coverage/action.yml | 2 +- .github/actions/upload-coverage/action.yml | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/actions/report-coverage/action.yml b/.github/actions/report-coverage/action.yml index c1f3294..104ecc5 100644 --- a/.github/actions/report-coverage/action.yml +++ b/.github/actions/report-coverage/action.yml @@ -3,7 +3,7 @@ description: "Combine Coverage and Report" inputs: fail_under: description: "The coverage amount to fail under" - default: 80 + default: "80" artifact_pattern: description: "" required: false diff --git a/.github/actions/upload-coverage/action.yml b/.github/actions/upload-coverage/action.yml index 70d86ed..8354393 100644 --- a/.github/actions/upload-coverage/action.yml +++ b/.github/actions/upload-coverage/action.yml @@ -6,7 +6,7 @@ inputs: artifact_name: description: The artifact name - useful if multiple artifacts are created required: false - default: coverage-data + default: "" runs: using: "composite" @@ -17,9 +17,18 @@ runs: if [ -f ".coverage" ]; then mv .coverage ".coverage.-$$-$RANDOM" fi + - name: Handle artifact name + id: artifact-name + shell: bash + run: | + export ARTIFACT_NAME=${{ inputs.artifact_name }} + if [ -z "$ARTIFACT_NAME" ]; then + export ARTIFACT_NAME="coverage-$RANDOM" + fi + echo "artifact_name=$ARTIFACT_NAME" >> "$GITHUB_OUTPUT" - name: Upload coverage data uses: actions/upload-artifact@v4 with: - name: ${{ inputs.artifact_name }} + name: ${{ steps.artifact-name.outputs.artifact_name }} path: ".coverage.*" if-no-files-found: ignore