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] The other_modified_files contains all modified files even those that match the file filter. #293

Closed
3 tasks done
tk185060 opened this issue Dec 29, 2021 · 2 comments · Fixed by #294
Closed
3 tasks done
Labels
bug Something isn't working

Comments

@tk185060
Copy link

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 other_modified_files contains all modified files even those that match the file filter, also it is not a list of unique matches.

To Reproduce

This is my usage

   - name: Get changed files
      id: changed-files
      uses: tj-actions/changed-files@v2.0.0 # see https://github.com/tj-actions/changed-files
      with:
        files: |  # used as "Extended Regular Expressions" (grep -E)
          **.yml$
          **.md$

While I deleted a bunch of .yml files and modified also README.md. Please see "Relevant log output" and evaluation of the "Non Matching modified files".

What OS are you seeing the problem on?

ubuntu-latest or ubuntu-20.04

Expected behavior?

PROBLEM: the steps.changed-files.outputs.other_modified_files contains both *.yml and README.md. But those are all matching the file filter. Also note that if I print all other_modified_files, the list somehow contains each file twice.

        for file in ${{ steps.changed-files.outputs.other_modified_files }}; do
          echo "$file was modified"
        done

prints this:

.github/workflows/choco_packages.yml was modified
.github/workflows/choco_packages.yml was modified
.github/workflows/devtestlab.yml was modified
.github/workflows/devtestlab_clean_vms.yml was modified
.github/workflows/gitleaks.yml was modified
.github/workflows/new_rcm_server.yml was modified
.github/workflows/new_rcm_snapshot.yml was modified
.github/workflows/new_snapshot.yml was modified
.github/workflows/new_swatlab.yml was modified
.github/workflows/remove_stale_runners.yml was modified
.github/workflows/rpos_bdd_sc.yml was modified
.github/workflows/test_build.yml was modified
.github/workflows/test_build_snapshot.yml was modified
.github/workflows/whitesource.yml was modified
README.md was modified
.github/workflows/devtestlab.yml was modified
.github/workflows/devtestlab_clean_vms.yml was modified
.github/workflows/gitleaks.yml was modified
.github/workflows/new_rcm_server.yml was modified
.github/workflows/new_rcm_snapshot.yml was modified
.github/workflows/new_snapshot.yml was modified
.github/workflows/new_swatlab.yml was modified
.github/workflows/remove_stale_runners.yml was modified
.github/workflows/rpos_bdd_sc.yml was modified
.github/workflows/test_build.yml was modified
.github/workflows/test_build_snapshot.yml was modified
.github/workflows/whitesource.yml was modified
README.md was modified

Relevant log output

changed-files
  Resolving repository path...
  Setting up 'temp_changed_files' remote...
  No 'temp_changed_files' remote found
  Creating 'temp_changed_files' remote...
  Getting HEAD info...
  remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0        
  From https://github.com/ncr-swt-cfr/cfr-build
   * [new branch]      main       -> main
   * [new branch]      main       -> temp_changed_files/main
  Retrieving changes between 6b3fe3d961b294b1a4ade72e19315bde17357fd8 (main) → 8b6a9100e6b5a2d343d9cb6f9f69db31dfb7758b (RPOS-000-Try-tj-actions-changed-files)
  Getting diff...
  Input files: **.md$ **.yml$
  Checking for file changes: "**.md$|**.yml$"...
  Matching changed files: .github/workflows/test_build.yml README.md
  Non Matching changed files: .github/workflows/test_build.yml .github/workflows/test_build.yml README.md README.md
  Matching modified files: .github/workflows/choco_packages.yml .github/workflows/devtestlab.yml .github/workflows/devtestlab_clean_vms.yml .github/workflows/gitleaks.yml .github/workflows/new_rcm_server.yml .github/workflows/new_rcm_snapshot.yml .github/workflows/new_snapshot.yml .github/workflows/new_swatlab.yml .github/workflows/remove_stale_runners.yml .github/workflows/rpos_bdd_sc.yml .github/workflows/test_build.yml .github/workflows/test_build_snapshot.yml .github/workflows/whitesource.yml README.md
  Non Matching modified files: .github/workflows/choco_packages.yml .github/workflows/choco_packages.yml .github/workflows/devtestlab.yml .github/workflows/devtestlab_clean_vms.yml .github/workflows/gitleaks.yml .github/workflows/new_rcm_server.yml .github/workflows/new_rcm_snapshot.yml .github/workflows/new_snapshot.yml .github/workflows/new_swatlab.yml .github/workflows/remove_stale_runners.yml .github/workflows/rpos_bdd_sc.yml .github/workflows/test_build.yml .github/workflows/test_build_snapshot.yml .github/workflows/whitesource.yml README.md .github/workflows/devtestlab.yml .github/workflows/devtestlab_clean_vms.yml .github/workflows/gitleaks.yml .github/workflows/new_rcm_server.yml .github/workflows/new_rcm_snapshot.yml .github/workflows/new_snapshot.yml .github/workflows/new_swatlab.yml .github/workflows/remove_stale_runners.yml .github/workflows/rpos_bdd_sc.yml .github/workflows/test_build.yml .github/workflows/test_build_snapshot.yml .github/workflows/whitesource.yml README.md
  Matching deleted files: .github/workflows/choco_packages.yml|.github/workflows/devtestlab.yml|.github/workflows/devtestlab_clean_vms.yml|.github/workflows/gitleaks.yml|.github/workflows/new_rcm_server.yml|.github/workflows/new_rcm_snapshot.yml|.github/workflows/new_snapshot.yml|.github/workflows/new_swatlab.yml|.github/workflows/remove_stale_runners.yml|.github/workflows/rpos_bdd_sc.yml|.github/workflows/test_build_snapshot.yml|.github/workflows/whitesource.yml
  Added files: 
  Copied files: 
  Deleted files: .github/workflows/choco_packages.yml .github/workflows/devtestlab.yml .github/workflows/devtestlab_clean_vms.yml .github/workflows/gitleaks.yml .github/workflows/new_rcm_server.yml .github/workflows/new_rcm_snapshot.yml .github/workflows/new_snapshot.yml .github/workflows/new_swatlab.yml .github/workflows/remove_stale_runners.yml .github/workflows/rpos_bdd_sc.yml .github/workflows/test_build_snapshot.yml .github/workflows/whitesource.yml
  Modified files: .github/workflows/test_build.yml README.md
  Renamed files: 
  Type Changed files: 
  Unmerged files: 
  Unknown files: 
  All changed and modified files: .github/workflows/choco_packages.yml .github/workflows/devtestlab.yml .github/workflows/devtestlab_clean_vms.yml .github/workflows/gitleaks.yml .github/workflows/new_rcm_server.yml .github/workflows/new_rcm_snapshot.yml .github/workflows/new_snapshot.yml .github/workflows/new_swatlab.yml .github/workflows/remove_stale_runners.yml .github/workflows/rpos_bdd_sc.yml .github/workflows/test_build.yml .github/workflows/test_build_snapshot.yml .github/workflows/whitesource.yml README.md
  All changed files: .github/workflows/test_build.yml README.md

Anything else?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@tk185060 tk185060 added the bug Something isn't working label Dec 29, 2021
@tk185060 tk185060 changed the title [BUG] The other_modified_files contains all modified files even those that match the file filter. [BUG] The other_modified_files contains all modified files even those that match the file filter. Dec 29, 2021
@jackton1
Copy link
Member

jackton1 commented Dec 30, 2021

@tk185060 I'll recommend using

 ➜  changed-files git:(main) git diff v2.0.0 main --name-only | grep -E "**.md$|**.yml$"
grep: repetition-operator operand invalid
➜  changed-files git:(main) git diff v2.0.0 main --name-only | grep -E "**.(md|yml)$"
grep: repetition-operator operand invalid
➜  changed-files git:(main) git diff v2.0.0 main --name-only | grep -E "*.(md|yml)$" 
grep: repetition-operator operand invalid
➜  changed-files git:(main) git diff v2.0.0 main --name-only | grep -E ".(md|yml)$"  # <- Recommended
.github/workflows/test.yml
HISTORY.md
README.md

@jackton1
Copy link
Member

@tk185060 This should now be resolved in the latest release. Thanks

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

Successfully merging a pull request may close this issue.

2 participants