-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Checkout repo before running path-filter job #27093
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
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThe CI path-filter job has been updated to explicitly checkout the repository before running the filter action, using a conditional ref expression to support both pull_request and repository_dispatch events. Sequence diagram for conditional repository checkout in path-filter jobsequenceDiagram
participant CI as "CI Runner"
participant GH as "GitHub Actions"
participant Repo as "Repository"
CI->>GH: Start path-filter job
GH->>Repo: Checkout code (actions/checkout@v5)
alt repository_dispatch event
GH->>Repo: Checkout ref "refs/pull/{number}/head"
else other events
GH->>Repo: Checkout default branch
end
GH->>GH: Run dorny/paths-filter action
GH->>CI: Output filter results
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
1ef491c to
0d1e382
Compare
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.
0d1e382 to
2ea1674
Compare
| docs: ${{ steps.filter.outputs.docs }} | ||
| non_docs: ${{ steps.filter.outputs.non_docs }} | ||
| steps: | ||
| - uses: actions/checkout@v5 |
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.
This won't work correctly.
It will detect no changes, and then jobs won't run.
see
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.
Pull Request Overview
This PR adds a repository checkout step to the path-filter CI job to ensure the repository is available before the path-filter action executes. This is particularly necessary when the workflow runs on the master branch.
Key Changes:
- Added
actions/checkout@v5step before the path-filter action with conditional ref handling for repository_dispatch events
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ref: | | ||
| ${{ github.event_name == 'repository_dispatch' && | ||
| github.event.client_payload.pull_request.head.sha == github.event.client_payload.slash_command.args.named.sha && | ||
| format('refs/pull/{0}/head', github.event.client_payload.pull_request.number) || '' }} |
Copilot
AI
Oct 24, 2025
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.
[nitpick] The multi-line conditional expression for the ref parameter is complex and difficult to parse. Consider extracting this logic into a separate step that sets an environment variable or output, making the checkout step's configuration clearer and easier to maintain.
Description
The path-filter CI job when run on master requires the repo to be checked out.
Additional context and related issues
Release notes
( ) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
( ) Release notes are required, with the following suggested text:
Summary by Sourcery
CI: