go-coverage-report
go-coverage-report copied to clipboard
Allow specifying TARGET Run ID
Current implementation will not behave as expected in a mono-repo with multiple Go projects. It would be beneficial to allow the user to optionally specify the LAST_SUCCESSFUL_RUN_ID or default to the existing behavior below:
start_group "Download code coverage results from target branch"
LAST_SUCCESSFUL_RUN_ID=$(gh run list --status=success --branch="$TARGET_BRANCH" --workflow="$GITHUB_WORKFLOW" --event=push --json=databaseId --limit=1 -q '.[] | .databaseId')
if [ -z "$LAST_SUCCESSFUL_RUN_ID" ]; then
echo "::error::No successful run found on the target branch"
exit 1
fi
For example, my use case would be something like:
gh run list --status=success --branch="main" --workflow="Go" --json=displayTitle,databaseId | jq -r '.[] | select(.displayTitle | contains("go/apps/app1")) | .databaseId' | head -n 1
I can create a PR from a fork for this if you'd like.
Yes that would be great. I currently only have very limited time to maintain projects on GitHub. :)