go-coverage-report icon indicating copy to clipboard operation
go-coverage-report copied to clipboard

Allow specifying TARGET Run ID

Open peter-crist opened this issue 1 year ago • 2 comments

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

peter-crist avatar Jun 05 '24 17:06 peter-crist

I can create a PR from a fork for this if you'd like.

peter-crist avatar Jun 12 '24 17:06 peter-crist

Yes that would be great. I currently only have very limited time to maintain projects on GitHub. :)

fgrosse avatar Jun 13 '24 06:06 fgrosse