Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/reusable-context.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ jobs:
run: python Tools/build/compute-changes.py
env:
GITHUB_DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
GITHUB_EVENT_NAME: ${{ github.event_name }}
CCF_TARGET_REF: ${{ github.base_ref || github.event.repository.default_branch }}
CCF_HEAD_REF: ${{ github.event.pull_request.head.sha || github.sha }}

Expand Down
2 changes: 1 addition & 1 deletion Tools/build/compute-changes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Copy link
Member

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

Suggested change
if os.environ.get("GITHUB_EVENT_NAME", "") == "pull_request":
if (
target_branch
and head_ref
and os.environ.get("GITHUB_EVENT_NAME", "") == "pull_request"
):

Copy link
Member Author

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.

# Getting changed files only makes sense on a pull request
files = get_changed_files(target_branch, head_ref)
outputs = process_changed_files(files)
Expand Down
Loading