changed-files: [BUG] Wrong changed-files returned for forked PRs

Is there an existing issue for this?

  • I have searched the existing issues

Does this issue exist in the latest version?

  • I’m using the latest release

Describe the bug?

Lately, we upgraded to the latest version of changed files, and we are again facing problems with the script detecting too many files changed.

The expected outcome for this PR: https://github.com/raycast/extensions/pull/3245

Will be to get the files listed in the files changed section, but instead, we get many extra files that have been changed on the main repository between the time this PR was created till the Check is running.

On this run you can see all those files being listed. They are coming from all commits that have been done on the main repository and probably coming from “merge” action during checkout. CleanShot 2022-10-26 at 17 30 59@2x

To Reproduce

  1. Setup main repository
  2. Fork the main repository
  3. Push some commits to main repository
  4. Push some commits to forked respository
  5. Run a files-changed on PR created from the forked repository and observe multiple files being reported on top of PR changes.

What OS are you seeing the problem on?

all

Expected behavior?

I would expect to only see files that are listed in PR. Instead of comparing to the BASE_SHA, it should instead compare to the commit that was used to do the merge, in our case 4ef2e916978e1c645499e3a6c7a536bdc3153403.

The last version that was behaving properly was v14.6 and it was really solid in this case. It was using a git log --no-merge to get proper SHA to compare to.

Relevant log output

No response

Anything else?

Is there a way to achieve the same behavior as in v14.6 for PRs? We need to upgrade script version due to GitHub deprecations.

Code of Conduct

  • I agree to follow this project’s Code of Conduct

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 43 (18 by maintainers)

Most upvoted comments

I have same issue. Basically, it returns difference between my “feature” branch and current master, but not only what I have changed in my branch. Means if master was updated after I have created my branch GH action will return as changed files “the delta” between both branches.

@jackton1 great to hear it’s not be going crazy 😃 Thanks for looking into this problem - I can imagine it’s quite unusual use-case, but for us, it’s happening every day 😦

@jackton1 according to what I have been observing on our repository, now that you have PR opened, you have to:

  • push a few commits changing something on master (so they are pushed after PR is opened)
  • push one more change to your PR branch (different file that on master) to make Checks run

In our case, that was showing then all files that were changed in master on top of PR file changes.

I tested it as well and I can confirm it doesn’t work properly. I’m getting all the changes again from the main branch when it should be just PR changes.

Here is the PR: https://github.com/raycast/extensions/pull/3171/files (11 files changed)

and related Check that returned all files from main branch: https://github.com/raycast/extensions/actions/runs/3532228657/jobs/5926328721

We also upgraded today to 34.4.4 - will be monitoring the behaviour this week on our monorepo

Got it, that helps I was able to replicate it here https://github.com/jackton1/demo3/actions/runs/3379055121/jobs/5610106082

I’m guessing you mean v14.6 instead of v14.3 as highlighted here?

The last version that was behaving properly was v14.6 and it was really solid in this case. It was using a git log --no-merge to get proper SHA to compare to.

hey @jackton1 - yes it’s still the same case we discussed a long time ago here. We are using your awesome action from that time and we sticked to 14.6 version as it was working perfectly, but now due to GitHub deprecations I wanted to upgrade and I found out it’s giving us completely different results than 14.6 😦