Skip to content

[BUG]: Workflow detects wrong changed files #2513

@FrankLeeeee

Description

@FrankLeeeee

🐛 Describe the bug

When we run workflows with GitHub actions, we often need to check what files are changed by the current PR. This will help us to decide the following actions to take. However, the changed file detection is working abnormally. One case which leads to errors is:

  1. you checkout from the main branch, let's call it branch A
  2. you push a commit to branch A
  3. some PRs are merged to the upstream main branch
  4. you put up a PR from your branch A to upstream main branch
  5. the list of changed files will not only include those changed on your branch A, but also those changed by other people's PRs

This root cause is the incorrect commit comparison as shown below.

Untitled Diagram drawio

What we really want is to find the files changed since the base commit instead of the remote latest commit.

Environment

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    DevOpsbugSomething isn't workingexampleexample-related issuer or pull request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions