-
Our GitHub PR action checks out the target default branch of a pull request. As long as the user's PR was rebased on the latest changes from the target branch, the changed-files action always returned a list of files that aligned directly with the PR changes. However, if the user's PR was not rebased or someone had pushed changes to the target branch, the action would report files changed from the PR commits and the target branch. With the release of v44, we noticed the warning about breaking changes on the release notes and decided to try the suggested change to see what we observed. This relied on us configuring the checkout step differently for the changed files jobs, which we did as follows:
It appears this compares the PR owner's fork and default branch. In my eyes, this seems to suffer from a similar yet slightly different problem. Why? I don't always synchronize my remote fork's default branch, so the comparison would be from a default branch from days/weeks/months ago. Is there a way with tj-actions to explicitly get a list of changed files related to the physical commits that are part of the PR itself and so that we can base our job tasks based only on those file lists rather than comparing with a target branch? In our project we have dozens of jobs that need to fire on a pull request to test a myriad of database matrices with various configurations and we ideally want to be as selective and target only the necessary jobs based on the user's changes. This is what we had hoped to observe from the v44 changes :(. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @Naros, yes you can base the comparison on only the commits in the PR by setting the - uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }} |
Beta Was this translation helpful? Give feedback.
Hi @Naros, yes you can base the comparison on only the commits in the PR by setting the
ref
input of the checkout action to prevent checking out the merge commitSee: https://github.com/actions/checkout/blob/main/README.md#checkout-pull-request-head-commit-instead-of-merge-commit.