Skip to content

Changed files with git commands detects too many files #205

@mirpedrol

Description

@mirpedrol

Hello!

We are using this GitHub Action with the modification in #133 to avoid reaching the API Rate limit.
Using git commands, the action paths filter uses the command git rev-parse HEAD to obtain the last commit. In PR events, this is the pre merge commit id. Because of that, we see too many files changed, not only the ones in the current PR.

One solution is to use git rev-parse HEAD^2 instead, in order to obtain the real last commit from the PR branch.
In the GitHub workflow yaml file, the following must also be added:

- uses: actions/checkout@v4
        with:
          fetch-depth: 2 # To retrieve the preceding commit.

I'm happy to open a PR to address this if you think it's the right way to go :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions