changed-files: [BUG] Using the fork point to detect file changes.

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?

We are experience a weird behaviour of changed files being returned on Pull Requests.

You can find my workflow runs here: https://github.com/raycast/extensions/runs/5148147932?check_suite_focus=true#step:3:107 https://github.com/raycast/extensions/runs/5149182650?check_suite_focus=true#step:3:107

Both of them runs on the same PR and against same main - the only different is that on main there were 2 commits added meanwhile I was testing it, you can see it here: CleanShot 2022-02-11 at 00 28 42@2x

Goal of our PRs is to validate files added by PR - I want to get files that were modified in PRs - only those files. But from time to time we are getting weird combination of files coming from changes done on main branch like you can see in first workflow run above. Expected behaviour is to get just the list of changed files in given PR - so the correct one is the second run.

Our workflow is doing just this:

- name: Checkout
        uses: actions/checkout@v2
        with:
          fetch-depth: 0
 - name: Get changed files
      id: changed-files
      uses: tj-actions/changed-files@v14.3

We have been playing with both:

base_sha: ${{ github.event.pull_request.base.sha }}
sha: ${{ github.event.pull_request.head.sha }}

and for some runs it helped, but it broke other PRs 😕 it’s a bit randomly behaving.

To Reproduce

  1. Use:
- name: Checkout
        uses: actions/checkout@v2
        with:
          fetch-depth: 0
 - name: Get changed files
      id: changed-files
      uses: tj-actions/changed-files@v14.3
  1. Create several PRs coming from forked repositories, meanwhile adding few commits in main repository
  2. Observe how randomly sometimes commits from main are taken into account. Some commits on main can fix the problem or break it when you re-run existing checks on PRs.

What OS are you seeing the problem on?

all

Expected behavior?

I would expect consistency.

Goal is to always get just changed files in PR - ignoring any changes that happened on main.

Relevant log output

Wrong: https://github.com/raycast/extensions/runs/5148147932?check_suite_focus=true#step:3:107

Right: https://github.com/raycast/extensions/runs/5149182650?check_suite_focus=true#step:3:107

Just re-runed after 2 commits were added.

Anything else?

All repositories and workflows are public. We have more runs like this happening: https://github.com/raycast/extensions/runs/5143485235?check_suite_focus=true

Not sure if that’s happening because of forking or what’s the problem - if we are doing something wrong in our workflows, please advice.

Code of Conduct

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

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 25 (12 by maintainers)

Commits related to this issue

Most upvoted comments

@grzegorzkrukowski The bug has been fixed in the latest release v20

Hey @jackton1 I am afraid it doesn’t work for some reason in our repository: https://github.com/raycast/extensions/runs/6129212969?check_suite_focus=true

It says about fetch-depth: 0 - but it’s there and still it doesn’t find properly the fork point 😦 We are still constantly struggling with a proper solution there…

Will do !! Thanks for your support ! Its one of the best axtions out there, couldnt live without it.

@jackton1 I see you have been doing a lot of merges from main into your branch: CleanShot 2022-02-16 at 10 21 20@2x

When you look at our example - we don’t really have merges - branch is never merged with main or rebased after its created.

Thanks @jackton1 - so now should I use my original version or one with ‘ref’ ?