Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Files detected as changed that are not part of PR #345

Closed
3 tasks done
Naros opened this issue Feb 4, 2022 · 4 comments
Closed
3 tasks done

[BUG] Files detected as changed that are not part of PR #345

Naros opened this issue Feb 4, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@Naros
Copy link

Naros commented Feb 4, 2022

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?

The tj-actions/changed-files action occasionally reports that files have changed and triggers specific jobs that would otherwise be skipped in our workflow on pull requests.

To Reproduce

We have a workflow defined like the following:

jobs:
  file_changes:
    name: "Detect changes"
    outputs:
      common-changed: ${{ steps.changed-files-common.outputs.any_changed }}
      path-abc-changed: ${{ steps.changed-files-path-abc.outputs.any_changed }}
      path-xyz-changed: ${{ steps.changed-files.path-xyz.outputs.any_changed }}
    steps:
      - name: Checkout Action
        uses: actions/checkout@v2
        with:
          fetch-depth: 0
      - name: Get modified files (common)
        id: changed-files-common
        uses: tj-actions/changed-files@v13.1
        with:
          files: |
            .github/workflows/common-workflow.yml
      - name: Get modified files (path-abc)
        id: changed-files-path-abc
        uses: tj-actions/changed-files@v13.1
        with:
          files: |
            path-abc/**
  path_abc:
  needs: [file_changes]
  if: ${{ needs.file_changes.outputs.common-changed == 'true' || needs.file_changes.outputs.path-abc-changed == 'true' }}
  ...
  path_xyz:
  needs: [file_changes]
  if: ${{ needs.file_changes.outputs.common-changed == 'true' || needs.file_changes.outputs.path-xyz-changed == 'true' }}
  ...
  1. User ABC submits PR 1234 that changes common-workflow.yml.
  2. User XYZ submits PR 2345 that changes files within the path-abc/** file path only.
  3. PR 1234 gets merged to main by a maintainer
  4. User XYZ pushes a new commit to PR 2345 that changes only files within the path-abc/** file path.

During the execution of the workflow in Step 2, everything works as we expect. It's during the execution of Step 4 after the PR that changes the workflow has been merged to main is when we observe this obscure execution of both the path_abc and path_xyz.

What OS are you seeing the problem on?

ubuntu-latest or ubuntu-20.04

Expected behavior?

Step 4 should only run the job for path_abc and not for path_xyz.

Relevant log output

  Added files: 
  Copied files: 
  Deleted files: 
  Modified files: .github/workflows/common-workflow.yml
  Renamed files: 
  Type Changed files: 
  Unmerged files: 
  Unknown files: 
  All changed and modified files: .github/workflows/common-workflow.yml
  All changed files: .github/workflows/common-workflow.yml
  All modified files: .github/workflows/common-workflow.yml

Anything else?

Could this be related to the any_changed output versus a different output variable we should use for this use case?

The goal that we are trying to mimic here is the equivalent of GitHub Action's paths syntax but rather than the workflow being conditionalized on the path changes, specific jobs within the workflow are to give us the best precision on running very long tests only on the most applicable modules based on the changes in the pull request or push.

Code of Conduct

  • I agree to follow this project's Code of Conduct
@Naros Naros added the bug Something isn't working label Feb 4, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2022

Thanks for reporting this issue.

@jackton1
Copy link
Member

jackton1 commented Feb 4, 2022

@Naros Based on the description you provided your approach is the right way to go, there have been a number of bug fixes since v13.1 and I'll recommend upgrading to the latest version v14.3.

@jackton1
Copy link
Member

jackton1 commented Feb 5, 2022

Closing this issue for now you can reopen or create a new issue if the problem persists

@jackton1 jackton1 closed this as completed Feb 5, 2022
@Naros
Copy link
Author

Naros commented Feb 5, 2022

Hi @jackton1, from what I could tell after upgrading to 14.3, that solved the matching problem 👏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants