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] Glob not matching changed files #829

Closed
3 tasks done
kd7lxl opened this issue Nov 29, 2022 · 3 comments
Closed
3 tasks done

[BUG] Glob not matching changed files #829

kd7lxl opened this issue Nov 29, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@kd7lxl
Copy link

kd7lxl commented Nov 29, 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?

I'm attempting to detect changed files in a directory like files: dir1/**. The changed files are not matched. any_changed is false and the changed files are only listed under other_changed_files. I think this means they were detected as changed but didn't match the glob as expected.

I've reproduced the issue with v32.0.0, v32, v33, and v34.

It works as intended on v31.0.3.

To Reproduce

Action:

    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0
      - name: Get new and changed files in the schema directory
        id: schema-files
        uses: tj-actions/changed-files@v34
        with:
          files: |
            dir1/**
      - run: echo '${{ toJSON(steps.schema-files.outputs) }}'
      - name: Schema file added, copied, modified, or renamed
        if: steps.schema-files.outputs.any_changed == 'true'
        run: |
          gh pr review "$PR_URL" --comment --body "Please do not edit files in dir1."
        env:
          PR_URL: ${{github.event.pull_request.html_url}}
          GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

Change a file at path dir1/foo/file.txt and push.

What OS are you seeing the problem on?

ubuntu-latest or ubuntu-20.04

Expected behavior?

Expected any change in the directory to match.

Relevant log output

Run tj-actions/changed-files@v33
  with:
    files: dir1/**
  
    separator:  
    include_all_old_new_renamed_files: false
    old_new_separator: ,
    old_new_files_separator:  
    files_separator: 
  
    files_ignore_separator: 
  
    sha: be5f2cdccb27eccdc6988f2e7a56a8e208da230d
    path: .
    quotepath: true
    dir_names: false
    json: false
    target_branch_fetch_depth: 20
Run # "Calculating the previous and current SHA..."
changed-files-diff-sha
Run tj-actions/glob@v15
...
Run echo '{
{
  "added_files": "",
  "copied_files": "",
  "deleted_files": "",
  "modified_files": "",
  "renamed_files": "",
  "all_old_new_renamed_files": "",
  "type_changed_files": "",
  "unmerged_files": "",
  "unknown_files": "",
  "all_changed_and_modified_files": "",
  "all_changed_files": "",
  "any_changed": "false",
  "only_changed": "false",
  "other_changed_files": ".github/workflows/review.yaml dir1/foo/file.txt",
  "all_modified_files": "",
  "any_modified": "false",
  "only_modified": "false",
  "other_modified_files": ".github/workflows/review.yaml dir1/foo/file.txt",
  "any_deleted": "false",
  "only_deleted": "",
  "other_deleted_files": ""
}

Anything else?

Sounds kind of similar to #450, but seems distinct.

Code of Conduct

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

Thanks for reporting this issue, don't forget to star this project if you haven't already to help us reach a wider audience.

@kd7lxl
Copy link
Author

kd7lxl commented Nov 29, 2022

Ah ha! I narrowed it down further. dir1 from my example is in the repo's .gitignore. .gitignore behavior changed here:

@kd7lxl kd7lxl closed this as completed Nov 29, 2022
@jackton1
Copy link
Member

jackton1 commented Dec 4, 2022

@kd7lxl In this case, I'll recommend using https://github.com/tj-actions/verify-changed-files which tracks changes to unstaged files.

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