-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
gh-133410: Fix PR detection in build workflow #133671
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, one optional nit
@@ -57,7 +57,7 @@ class Outputs: | |||
|
|||
def compute_changes() -> None: | |||
target_branch, head_ref = git_refs() | |||
if target_branch and head_ref: | |||
if os.environ.get("GITHUB_EVENT_NAME", "") == "pull_request": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that this should be and
if os.environ.get("GITHUB_EVENT_NAME", "") == "pull_request": | |
if ( | |
target_branch | |
and head_ref | |
and os.environ.get("GITHUB_EVENT_NAME", "") == "pull_request" | |
): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #133410 (comment), the original problem is that target_branch
and head_ref
are always be truthy, so I don't think we need to check them.
Thanks @hugovk for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13. |
Thanks @hugovk for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14. |
(cherry picked from commit 319acf3) Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
(cherry picked from commit 319acf3) Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
GH-134054 is a backport of this pull request to the 3.13 branch. |
GH-134055 is a backport of this pull request to the 3.14 branch. |
Thanks @hugovk for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12. |
(cherry picked from commit 319acf3) Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
GH-134057 is a backport of this pull request to the 3.12 branch. |
It's running on my fork: https://github.com/hugovk/cpython/actions/runs/14908903403/job/41878001194#step:6:16
And on this PR: https://github.com/python/cpython/actions/runs/14909052522/job/41878505661?pr=133671#step:6:19
Tools/build/compute-changes.py
looks at the wrong branches #133410