In sync tool, fix "existing PR" query: consider repository name #127
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.
Fixes an error in the sync pipeline that occurred because two active PRs into branches named
microsoft/main
were happening at the same time, microsoft/go#1251 and microsoft/go-images#316:https://dev.azure.com/dnceng/internal/_build/results?buildId=2477557&view=logs&j=881b2ec9-fc45-57ee-6456-bdd38ea7f007&t=a85e175a-b476-51c2-71e7-c3450accbe07&l=201
The GraphQL API doesn't have a filter for repository name, and the job got this data:
The sync code has a safeguard to make sure only 1 or 0 results were returned to make sure that it doesn't get mixed up. That was triggered and the sync pipeline failed safe:
#124 uncovered this issue because, for the first time, the synced branch names used in multiple repos overlapped.
This PR fixes it by adding an extra field that GraphQL should return from the query,
nameWithOwner
. (microsoft/go
,microsoft/go-images
.) It's used to filter the results down. I used https://docs.github.com/en/graphql/overview/explorer to find and try out this new field.