Skip to content

Conversation

iangmaia
Copy link
Contributor

@iangmaia iangmaia commented Oct 6, 2025

Fixes AINFRA-1359

What does it do?

Fixes GitHub API search queries to support fine-grained tokens in addition to classic tokens.

GitHub's fine-grained tokens enforce stricter search query requirements than classic tokens. This seems to be a bug in the API as it worked fine without parameters with classic tokens, but when searching for issues and PRs in a milestone, fine-grained tokens require explicit is:issue or is:pull-request qualifiers -- it seems you cannot search for both simultaneously in a single query.

This change should maintain backward compatibility with classic tokens while adding support for fine-grained tokens. The public API remains unchanged.

Testing

I've created a simple test lane locally on WooAndroid to test the updated action:

See test lane ⬇️
  lane :test_milestone do
      # Move PRs to next milestone
      moved_issues = update_assigned_milestone(
        github_token: ENV['WOO_TOKEN'],
        repository: GITHUB_REPO,
        from_milestone: '0.1',
        to_milestone: '0.2',
        comment: "Test moving milestones."
      )

      UI.message("Items moved: #{moved_issues}")
  end

I created the test milestones 0.1 and 0.2, assigned 0.1 to this issue and this PR and ran the lane twice: first with the fine-grained token, moving issues from 0.1 to 0.2 and then with a classic token performing the same operation again.

PR activity ⬇️ Screenshot 2025-10-06 at 17 42 34

Checklist before requesting a review

  • Run bundle exec rubocop to test for code style violations and recommendations.
  • Add Unit Tests (aka specs/*_spec.rb) if applicable.
  • Run bundle exec rspec to run the whole test suite and ensure all your tests pass.
  • Make sure you added an entry in the CHANGELOG.md file to describe your changes under the appropriate existing ### subsection of the existing ## Trunk section.
  • If applicable, add an entry in the MIGRATION.md file to describe how the changes will affect the migration from the previous major version and what the clients will need to change and consider.

@iangmaia iangmaia self-assigned this Oct 6, 2025
@iangmaia iangmaia added the bug Something isn't working label Oct 6, 2025
@iangmaia iangmaia marked this pull request as ready for review October 6, 2025 15:44
Copy link
Contributor

@AliSoftware AliSoftware left a comment

Choose a reason for hiding this comment

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

👌 :shipit:

@iangmaia iangmaia merged commit 0927262 into trunk Oct 6, 2025
9 checks passed
@iangmaia iangmaia deleted the iangmaia/fix-issue-search branch October 6, 2025 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants