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] dir_names + files combo ends up in error #757

Closed
3 tasks done
jkremser opened this issue Nov 4, 2022 · 8 comments · Fixed by #758
Closed
3 tasks done

[BUG] dir_names + files combo ends up in error #757

jkremser opened this issue Nov 4, 2022 · 8 comments · Fixed by #758
Labels
bug Something isn't working

Comments

@jkremser
Copy link

jkremser commented Nov 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?

When using dir_names: true and files with globs, it ends up with pipe error

To Reproduce

When calling the action like this:

      - name: Get changed files
        id: changed-files
        uses: tj-actions/changed-files@v34
        with:
          dir_names: "true"
          files: |
            **/values.json
            **/values.schema.json

(full workflow https://github.com/jkremser/log2rbac-operator/actions/runs/3393837005/workflow)

I got following error:

Run tj-actions/changed-files@v34
Run # "Calculating the previous and current SHA..."
changed-files-diff-sha
Run tj-actions/glob@v15
/usr/bin/git rev-parse --show-toplevel
/home/runner/work/log2rbac-operator/log2rbac-operator
/usr/bin/git diff --diff-filter=D --name-only 60ae0af0ea0ee489[39](https://github.com/jkremser/log2rbac-operator/actions/runs/3393806933/jobs/5641569331#step:5:41)13e8a498b53ce1497abd48 6628f93e06c0e58948add09bba03513dd0566780
Run bash $GITHUB_ACTION_PATH/get-changed-paths.sh
changed-files
  Resolving repository path: /home/runner/work/log2rbac-operator/log2rbac-operator/.
  Retrieving changes between 60ae0af0ea0ee4893913e8a498b53ce1497abd48 (master) → 6628f93e06c0e58948add09bba03513dd0566780 (helm-json-schema)
  grep: : No such file or directory
  fatal: 60ae0af0ea0ee4893913e8a498b53ce1497abd48...6628f93e06c0e58948add09bba03513dd0566780: no merge base
  /home/runner/work/_actions/tj-actions/changed-files/v34/get-changed-paths.sh: line 59: echo: write error: Broken pipe
  Error: Process completed with exit code 1.

What OS are you seeing the problem on?

ubuntu-latest or ubuntu-20.04

Expected behavior?

list of directories where those files specified in files are

Relevant log output

No response

Anything else?

No response

Code of Conduct

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

github-actions bot commented Nov 4, 2022

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

@jackton1
Copy link
Member

jackton1 commented Nov 5, 2022

Hi @jkremser can you verify that this has been resolved. Thanks

@SiddhantSadangi
Copy link

SiddhantSadangi commented Nov 7, 2022

@jackton1
I don't see any error, but using file filters still breaks dir_names

Without filters

      - name: Get changed directories
        id: changed-dirs
        uses: tj-actions/changed-files@v34
        with:
          dir_names: "true"
          json: true
      - name: List all changed files
        run: |
          for file in ${{ steps.changed-dirs.outputs.all_changed_files }}; do
            echo "$file was changed"
          done

This lists changes.
Link to run: https://github.com/neptune-ai/examples/actions/runs/3407737702/jobs/5667669387

With filters

      - name: Get changed directories
        id: changed-dirs
        uses: tj-actions/changed-files@v34
        with:
          dir_names: "true"
          json: true
          files: |
            **/scripts/*
          files_ignore: |
            **/neptune-docker/*
            **/kedro/*
      - name: List all changed files
        run: |
          for file in ${{ steps.changed-dirs.outputs.all_changed_files }}; do
            echo "$file was changed"
          done

This doesn't return any changes.
Link to run: https://github.com/neptune-ai/examples/actions/runs/3407713523/jobs/5667617759

@jackton1
Copy link
Member

jackton1 commented Nov 7, 2022

@SiddhantSadangi I'll recommend swapping * for ** I.e **/scripts/* to **/scripts/**.

I’ll also point out that except the files listed in the files input overlap those listed in the files_ignore Input, It’s not really required as the files input specifies only a subset of files/directories that should be watched for any changed files.

@jbritt1
Copy link

jbritt1 commented Dec 16, 2022

The original issue still exists. The second user changed the issue where they were using dir names and filtering other dirs. Combining dir names and files with extensions however still produces an error or an empty array.

@jbritt1
Copy link

jbritt1 commented Dec 16, 2022

Here is a further example of how you can't currently mix the two:

image

In my example I have made two new directories. In terraform/global/jb I have a main.tf file and would expect it to be caught by the action. In the terraform/global/jb/test dir however, I only have a test.txt file and would NOT expect it to appear here given the inputs of:

with:
  dir_names: true
  json: true
  files: |
    terraform/
  files_ignore: |
    !**/*.tf

@jbritt1
Copy link

jbritt1 commented Dec 16, 2022

@jackton1, any thoughts?

@jbritt1
Copy link

jbritt1 commented Dec 16, 2022

Here is an example of the broken pipe from the original issue as well:

image

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.

4 participants