Skip to content

Commit

Permalink
add workflow summary
Browse files Browse the repository at this point in the history
  • Loading branch information
JTaeuber committed Feb 28, 2025
1 parent b92e354 commit 44ee0d8
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/prune.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,24 @@ jobs:
echo "Fetching Cosign signature tags..."
SIG_TAGS=$(gh api -H "Accept: application/vnd.github.v3+json" "/orgs/$GH_OWNER/packages/container/$IMAGE_NAME/versions" | jq -r '.[].name | select(test("^sha256-[a-f0-9]+\\.sig$"))')
PRUNED_SIGS="### Pruned Cosign Signatures\n\n" # Header for workflow summary
SIG_DELETED=false
for SIG in $SIG_TAGS; do
SIG_DIGEST="${SIG#sha256-}" # Remove 'sha256-' prefix
SIG_DIGEST="${SIG_DIGEST%.sig}" # Remove '.sig' suffix
if ! echo "$REMAINING_DIGESTS" | grep -q "^$SIG_DIGEST$"; then
echo "Deleting orphaned signature: $SIG"
# gh api --method DELETE -H "Accept: application/vnd.github.v3+json" "/orgs/$GH_OWNER/packages/container/$IMAGE_NAME/versions/$SIG"
PRUNED_SIGS+="- $SIG\n"
SIG_DELETED=true
fi
done
# Append to GitHub summary only if signatures were deleted
if [ "$SIG_DELETED" = true ]; then
echo -e "$PRUNED_SIGS" >> $GITHUB_STEP_SUMMARY
else
echo "No orphaned signatures found." >> $GITHUB_STEP_SUMMARY
fi

0 comments on commit 44ee0d8

Please sign in to comment.