BUILD-9451 Fix artifact cleanup pagination#210
Merged
julien-carsique-sonarsource merged 1 commit intomasterfrom Feb 12, 2026
Merged
BUILD-9451 Fix artifact cleanup pagination#210julien-carsique-sonarsource merged 1 commit intomasterfrom
julien-carsique-sonarsource merged 1 commit intomasterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes artifact cleanup pagination to handle unlimited artifacts across multiple API pages and resolves a test-cleanup failure from a previously merged PR.
Changes:
- Added pagination support to fetch all artifacts and cache entries across multiple API pages
- Updated
gh apicommands to use--paginateflag with appropriate filters - Fixed test mock to match the new command pattern with pagination
- Added
CACHE_LIST_LIMITconstant to handle cache pagination limits
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| pr_cleanup/cleanup.sh | Added pagination support to artifact and cache API calls, introduced cache list limit constant |
| spec/pr_cleanup_spec.sh | Updated test mock pattern to match new paginated API command structure |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Implement full pagination support to handle unlimited numbers of items: - Cache operations: Use --limit 100000 with gh cache list (GitHub's practical maximum) - Artifact operations: Use gh api --paginate to fetch ALL artifacts across all pages Changes to artifact cleanup: - Replace ?per_page=100 limit with --paginate for complete pagination - Line 50: Use --paginate with --jq to collect artifact IDs from all pages - Lines 47, 60: Use --paginate with --template for display (filtering remains in template) - Keep branch filtering in artifact_template.tpl (required when using --template) Technical note: - Cannot use --slurp with --jq or --template (gh api limitation) - With --paginate --jq: Filter is applied to each page, results are concatenated - With --paginate --template: Template is rendered for each page separately This ensures complete cleanup of PR resources regardless of count: - Caches: up to 100,000 items (GitHub's limit) - Artifacts: unlimited (all pages processed) Previously, artifact cleanup was limited to the first 100 items per API call, leaving orphaned artifacts when PRs had >100 artifacts. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
9aa8f86 to
06bf280
Compare
SonarQube reviewer guide
|
bwalsh434
approved these changes
Feb 12, 2026
Contributor
bwalsh434
left a comment
There was a problem hiding this comment.
LGTM, less necessary jq 👍
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




BUILD-9451
Summary
gh api --paginateto fetch ALL artifacts across all pages (unlimited)Changes
--slurpwith--paginatealone (gh api doesn't support--slurpwith--jq/--template)🤖 Generated with Claude Code