Skip to content

Set up publishing of SNAPSHOT builds to GitHub Packages#76

Merged
carlspring merged 1 commit intomasterfrom
issue/74/remove-snapshots-on-merge
Mar 30, 2026
Merged

Set up publishing of SNAPSHOT builds to GitHub Packages#76
carlspring merged 1 commit intomasterfrom
issue/74/remove-snapshots-on-merge

Conversation

@carlspring
Copy link
Copy Markdown
Collaborator

@carlspring carlspring commented Mar 30, 2026

Description

Fixes for #74:

  • Remove SNAPSHOT packages based on the pull request upon merge.

Summary by CodeRabbit

  • Chores
    • Improved snapshot package cleanup workflow with stricter error handling and refined version deletion logic for better management of edge cases.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 30, 2026

Warning

Rate limit exceeded

@carlspring has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 23 minutes and 16 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 23 minutes and 16 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 775d9c5a-861e-4a41-bbc8-72caf7cb7290

📥 Commits

Reviewing files that changed from the base of the PR and between 0699854 and df70f1c.

📒 Files selected for processing (2)
  • .github/workflows/build.yml
  • .github/workflows/cleanup-snapshot.yml

Walkthrough

The GitHub Actions workflow for cleaning up snapshot packages now includes stricter shell error handling and a new variable for parameterizing Maven endpoints. The cleanup logic has been enhanced to fetch total version counts, log this information, and conditionally delete entire packages when few versions remain, rather than attempting individual version deletions.

Changes

Cohort / File(s) Summary
Workflow Enhancement
.github/workflows/cleanup-snapshot.yml
Added strict error handling (set -euo pipefail), introduced PACKAGE_NAME variable, integrated API call to fetch and log total version count, and modified deletion logic to support full package deletion when total versions ≤ 1, with enhanced version iteration handling.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title 'Set up publishing of SNAPSHOT builds to GitHub Packages' does not align with the actual changes, which focus on removing/cleaning up SNAPSHOT packages, not setting up publishing. Revise the title to accurately reflect the primary change, such as 'Add cleanup workflow for SNAPSHOT packages in GitHub Packages' or 'Implement SNAPSHOT package removal on merge'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issue/74/remove-snapshots-on-merge

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
.github/workflows/cleanup-snapshot.yml (1)

39-44: Verify error suppression doesn't mask API issues.

The 2>/dev/null || true pattern allows graceful handling when the package doesn't exist, but it also suppresses all stderr including potential API errors (rate limiting, auth issues, network failures). For a cleanup job this is generally acceptable, but consider whether logging stderr while still allowing the script to continue would aid debugging.

          ALL_VERSION_IDS=$(gh api \
            --paginate \
            -H "Accept: application/vnd.github+json" \
            "/orgs/${{ github.repository_owner }}/packages/maven/${PACKAGE_NAME}/versions" \
-            --jq ".[].id" 2>/dev/null || true)
+            --jq ".[].id" 2>&1 || true)

This would log any errors while still continuing execution. However, the current approach is reasonable if you prefer cleaner logs when packages don't exist.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/cleanup-snapshot.yml around lines 39 - 44, The current gh
api call that populates ALL_VERSION_IDS uses "2>/dev/null || true" which hides
all stderr (masking API errors); update the invocation that builds
ALL_VERSION_IDS to capture and log stderr while still allowing the command to
succeed if the package is missing — for example, pipe stderr to a logger/tee or
a temp file and then continue with "|| true". Target the gh api call that
constructs ALL_VERSION_IDS and ensure any captured stderr is printed to the
workflow log (or stored) before continuing so rate-limit/auth/network errors are
visible while preserving the graceful fallback when the package doesn't exist.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In @.github/workflows/cleanup-snapshot.yml:
- Around line 39-44: The current gh api call that populates ALL_VERSION_IDS uses
"2>/dev/null || true" which hides all stderr (masking API errors); update the
invocation that builds ALL_VERSION_IDS to capture and log stderr while still
allowing the command to succeed if the package is missing — for example, pipe
stderr to a logger/tee or a temp file and then continue with "|| true". Target
the gh api call that constructs ALL_VERSION_IDS and ensure any captured stderr
is printed to the workflow log (or stored) before continuing so
rate-limit/auth/network errors are visible while preserving the graceful
fallback when the package doesn't exist.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b06c800f-f41d-4729-800f-da2f65b0b37f

📥 Commits

Reviewing files that changed from the base of the PR and between bbee812 and 0699854.

📒 Files selected for processing (1)
  • .github/workflows/cleanup-snapshot.yml

@carlspring carlspring force-pushed the issue/74/remove-snapshots-on-merge branch from 0699854 to df70f1c Compare March 30, 2026 03:09
@carlspring carlspring merged commit cebfa08 into master Mar 30, 2026
10 checks passed
@carlspring carlspring deleted the issue/74/remove-snapshots-on-merge branch March 30, 2026 03:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant