Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: fix PR title ci job concurrency #1451

Merged
merged 1 commit into from
Nov 19, 2024
Merged

Conversation

dimaqq
Copy link
Contributor

@dimaqq dimaqq commented Nov 7, 2024

https://matrix.to/#/!eNCNzcteYUDDYpStsu:ubuntu.com/$PjGy1bizJkNGgu-A629wckDFKPzEQ5BKXIkmlE8sUyg?via=ubuntu.com&via=matrix.org

Huh, looks like we have a small bug in the CI:

Canceling since a higher priority waiting request for 'Validate PR Title-refs/heads/main' exists

which happened for this PR: #1447

surely the concurrency group should not be set to "main" for a new PR, should it?

@dimaqq
Copy link
Contributor Author

dimaqq commented Nov 7, 2024

I was thinking to use branch names first, but what if both tony and david issue a PR from their forks' main?
github.event.pull_request.number seems to be canonical on Stack Overflow, even if the .event feels like a private API.

@dimaqq dimaqq changed the title ci: fix PR title concurrency ci: fix PR title ci job concurrency Nov 7, 2024
@dimaqq dimaqq requested a review from benhoyt November 7, 2024 03:43
@james-garner-canonical
Copy link
Contributor

Interestingly, the documentation indicates that github.ref should be refs/pull/<pr_number>/merge for pull requests, which should be just as unique a event.pull_request.number, shouldn't it?

I can't find the documentation for event.pull_request.number, but I guess the value is that it gives you just the PR number if you want to do something with that.

@james-garner-canonical
Copy link
Contributor

james-garner-canonical commented Nov 7, 2024

Ah, I see that for the linked PR where we had this issue, github.ref evaluated to refs/heads/main. The documentation says: 'for branches the format is refs/heads/<branch_name>, for pull requests it is refs/pull/<pr_number>/merge', so the dependabot PR isn't being treated as a PR in ci?

EDIT: or the documentation is just wrong?

@dimaqq
Copy link
Contributor Author

dimaqq commented Nov 7, 2024

Interestingly, the documentation indicates that github.ref should be refs/pull/<pr_number>/merge for pull requests, which should be just as unique a event.pull_request.number, shouldn't it?

Bad docs.

I think they meant to say "for a pull request merge event," or something alike.

It's clearly the base branch for outstanding pull requests in the context of the pull_request_target event.

I guess _target is kinda magical anyway.

Or, rather, target is reasonable, but plain PR event is magical, because if the base branch has moved on, GitHub will make a "fake merge" (what you'd get if you merged the PR right now) to run the action against, and if there's no clean fake merge, it'd run against "fake merge against base" or something like that. Convoluted.

@dimaqq dimaqq requested a review from dwilding November 7, 2024 06:13
@dimaqq
Copy link
Contributor Author

dimaqq commented Nov 14, 2024

A penny for anyone's review?

Copy link
Contributor

@james-garner-canonical james-garner-canonical left a comment

Choose a reason for hiding this comment

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

Looks good, thanks for opening that github docs PR, that helped me understand what's going on with the github.ref

@dimaqq dimaqq merged commit ed60cdd into canonical:main Nov 19, 2024
32 checks passed
@dimaqq dimaqq deleted the chore-fix-ci branch November 19, 2024 00:35
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