diff options
-rw-r--r-- | .github/workflows/coverage.yml | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 78359be3..9385ff5f 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -141,12 +141,15 @@ jobs: steps: - name: "Checkout reports repo" - # TODO: sparse checkout would be great - uses: actions/checkout@v2 - with: - repository: nedbat/coverage-reports - path: ./reports_repo - token: ${{ secrets.COVERAGE_REPORTS_TOKEN }} + run: | + set -xe + git clone --depth=1 --no-checkout https://${{ secrets.COVERAGE_REPORTS_TOKEN }}@github.com/nedbat/coverage-reports reports_repo + cd reports_repo + git sparse-checkout init --cone + git sparse-checkout set '/*' '!/reports' + git config user.name nedbat + git config user.email ned@nedbatchelder.com + git checkout main - name: "Download coverage JSON report" uses: actions/download-artifact@v2 @@ -156,6 +159,7 @@ jobs: - name: "Compute info for later steps" id: info run: | + set -xe export TOTAL=$(python -c "import json;print(json.load(open('coverage.json'))['totals']['percent_covered_display'])") export PCTINT=$(echo $TOTAL | cut -f1 -d.) export SHA10=$(echo ${{ github.sha }} | cut -c 1-10) @@ -181,6 +185,7 @@ jobs: - name: "Push to report repo" run: | + set -xe # Make the redirect to the latest report. echo "<html><head>" > reports_repo/latest.html echo "<meta http-equiv='refresh' content='0;url=${{ env.url }}' />" >> reports_repo/latest.html @@ -192,11 +197,9 @@ jobs: echo "${{ env.sha10 }}: ${{ env.branch }}" >> commit.txt # Commit. cd ./reports_repo + git sparse-checkout set '/*' '${{ env.report_dir }}' rm ${{ env.report_dir }}/.gitignore - git add ${{ env.report_dir }} - git add latest.html - git config user.name nedbat - git config user.email ned@nedbatchelder.com + git add ${{ env.report_dir }} latest.html git commit --file=../commit.txt git push |