Skip to content

Conversation

@ivanzati
Copy link
Contributor

@ivanzati ivanzati commented Nov 7, 2025

πŸ“ Description

Fixing processing of paginated return of packages in collect-source.yml workflow

✨ Type of Change

Select the type of change your PR introduces:

  • [x ] 🐞 Bug fix – Non-breaking change which fixes an issue
  • πŸš€ New feature – Non-breaking change which adds functionality
  • πŸ”¨ Refactor – Non-breaking change which refactors the code base
  • πŸ’₯ Breaking change – Changes that break existing functionality
  • πŸ“š Documentation update
  • πŸ”’ Security update
  • πŸ§ͺ Tests

πŸ§ͺ Testing Scenarios

Describe how the changes were tested and how reviewers can test them too:

  • βœ… Tested manually
  • πŸ€– Run automated end-to-end tests

βœ… Checklist

Before submitting the PR, ensure the following:

  • πŸ” PR title is clear and meaningful
  • ✍️ PR description clearly explains the changes and their reason
  • πŸ“ I have linked the PR to the corresponding GitHub Issues, if any
  • πŸ’¬ I have commented my code, especially in hard-to-understand areas
  • πŸ“„ I have made corresponding changes to the documentation
  • βœ… I have added tests that prove my fix is effective or my feature works

Copilot AI review requested due to automatic review settings November 7, 2025 15:39
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes the pagination handling in the collect-source.yml workflow to ensure all packages are retrieved when querying the GitHub API. The changes address a bug where only the first page of results was being processed.

Key Changes:

  • Added --paginate flag to GitHub API calls to retrieve all pages of results
  • Changed grep -w to grep -x for exact tag matching

πŸ’‘ Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

VERSION=$(gh api --paginate -H "Accept: application/vnd.github.v3+json" \
/orgs/open-edge-platform/packages/container/$TMP_NAME/versions \
--jq '.[].metadata.container.tags[]' 2>/dev/null | grep -w "$TAG" || true)
--jq '.[].metadata.container.tags[]' 2>/dev/null | grep -x "$TAG" || true)
Copy link

Copilot AI Nov 7, 2025

Choose a reason for hiding this comment

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

The --paginate flag combined with --jq may cause issues because pagination returns multiple JSON arrays, but jq processes each page separately. This could result in the grep command receiving partial data or failing to match tags that span across pages. Consider using --jq '.[] | .metadata.container.tags[] | select(. == \"'$TAG'\")' to handle the filtering within jq itself, which will work correctly with pagination.

Suggested change
--jq '.[].metadata.container.tags[]' 2>/dev/null | grep -x "$TAG" || true)
--jq '.[] | .metadata.container.tags[] | select(. == "'"$TAG"'")' 2>/dev/null)

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@AlexanderBarabanov AlexanderBarabanov left a comment

Choose a reason for hiding this comment

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

Thank you, Ivan!

@ivanzati ivanzati added this pull request to the merge queue Nov 10, 2025
Merged via the queue into main with commit 46cbfc9 Nov 10, 2025
55 of 57 checks passed
@ivanzati ivanzati deleted the ivanzati/fix-collect-source-workflow branch November 10, 2025 11:08
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.

3 participants