Skip to content

Commit

Permalink
Merge pull request #8047 from dependabot/jamiemagee/generate-coverage…
Browse files Browse the repository at this point in the history
…-report
  • Loading branch information
JamieMagee authored Sep 15, 2023
2 parents 185e1e1 + 40c1a5d commit 0d56f1b
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
14 changes: 13 additions & 1 deletion .github/workflows/sorbet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,19 @@ jobs:

- run: bundle exec spoom coverage timeline --save

- uses: actions/upload-artifact@v3
- if: github.ref == 'refs/heads/main' && github.event_name == 'push'
uses: actions/upload-artifact@v3
with:
name: spoom_data
path: ./spoom_data/

- if: github.ref == 'refs/heads/main' && github.event_name == 'push'
run: ./script/generate-coverage-report
env:
GH_TOKEN: ${{ github.token }}

- if: github.ref == 'refs/heads/main' && github.event_name == 'push'
uses: actions/upload-artifact@v3
with:
name: spoom_report
path: ./spoom_report.html
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,6 @@ coverage/
.rdbg_history
# Ignore Jetbrains IntelliJ project-config directory
.idea/
# Ignore spoom coverage report
spoom_data/
spoom_report.html
21 changes: 21 additions & 0 deletions script/generate-coverage-report
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash
set -euo pipefail

total_snapshots=$(gh api -X GET /repos/dependabot/dependabot-core/actions/artifacts -f name=spoom_data -f per_page=100)
echo "$(jq -r '.total_count' <<< "$total_snapshots")" snapshots found in total

main_snapshots=$(jq -r '.artifacts[] | select(.name == "spoom_data" and .workflow_run.head_branch == "main") | .id' <<< "$total_snapshots")
echo "$(wc -w <<< "$main_snapshots")" snapshots found on main branch

for id in $main_snapshots; do
gh api /repos/dependabot/dependabot-core/actions/artifacts/"$id" | \
jq -r '.archive_download_url' | \
xargs gh api -X GET > spoom_data.zip && \
unzip -qq -o spoom_data.zip -d spoom_data && \
rm spoom_data.zip
done

echo Download complete

echo Generating coverage report
bundle exec spoom coverage report

0 comments on commit 0d56f1b

Please sign in to comment.