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] Unable to use a custom files_from_source_file_separator #1654

Closed
4 tasks done
nistalhelmuth opened this issue Oct 18, 2023 · 7 comments
Closed
4 tasks done

[BUG] Unable to use a custom files_from_source_file_separator #1654

nistalhelmuth opened this issue Oct 18, 2023 · 7 comments
Labels
bug Something isn't working

Comments

@nistalhelmuth
Copy link

nistalhelmuth commented Oct 18, 2023

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?

Is not possible to use a comma separated value file as files_from_source_file input.
Screenshot 2023-10-18 at 10 13 32

To Reproduce

  1. Modify files in specific directories.
  2. Create a comma separated value file containing the directories that are going to be evaluated.
  3. Configures inputs for actions as follows:
- name: Get changed files
    id: changed-files
    uses: tj-actions/changed-files@v39
    with:
      dir_names: true
      dir_names_max_depth: 2
      separator: ","
      files_from_source_file_separator: ,
      files_from_source_file: .github/directories_list.txt
  1. Check the output.

What OS are you seeing the problem on?

ubuntu-latest or ubuntu-22.04

Expected behavior?

Same PR just using "\n" as separator for files_from_source_file.
Screenshot 2023-10-18 at 10 14 37

Relevant log output

2023-10-18T16:10:07.4803074Z ##[group]Run tj-actions/changed-files@v39
2023-10-18T16:10:07.4803544Z with:
2023-10-18T16:10:07.4803793Z   dir_names: true
2023-10-18T16:10:07.4804107Z   dir_names_max_depth: 2
2023-10-18T16:10:07.4804456Z   separator: ,
2023-10-18T16:10:07.4804762Z   files_from_source_file_separator: ,
2023-10-18T16:10:07.4805422Z   files_from_source_file: .github/directories_list.txt
2023-10-18T16:10:07.4805941Z   include_all_old_new_renamed_files: false
2023-10-18T16:10:07.4806344Z   old_new_separator: ,
2023-10-18T16:10:07.4806673Z   old_new_files_separator:  
2023-10-18T16:10:07.4807027Z   files_separator: 

2023-10-18T16:10:07.4807358Z   files_yaml_from_source_file_separator: 

2023-10-18T16:10:07.4807838Z   files_ignore_yaml_from_source_file_separator: 

2023-10-18T16:10:07.4808292Z   files_ignore_separator: 

2023-10-18T16:10:07.4808670Z   files_ignore_from_source_file_separator: 

2023-10-18T16:10:07.4809085Z   path: .
2023-10-18T16:10:07.4809351Z   quotepath: true
2023-10-18T16:10:07.4809686Z   diff_relative: true
2023-10-18T16:10:07.4810017Z   dir_names_exclude_current_dir: false
2023-10-18T16:10:07.4810442Z   dir_names_include_files_separator: 

2023-10-18T16:10:07.4810946Z   dir_names_deleted_files_include_only_deleted_dirs: false
2023-10-18T16:10:07.4811412Z   json: false
2023-10-18T16:10:07.4811692Z   escape_json: true
2023-10-18T16:10:07.4811996Z   fetch_depth: 50
2023-10-18T16:10:07.4812294Z   skip_initial_fetch: false
2023-10-18T16:10:07.4812683Z   fetch_additional_submodule_history: false
2023-10-18T16:10:07.4813120Z   since_last_remote_commit: false
2023-10-18T16:10:07.4813487Z   write_output_files: false
2023-10-18T16:10:07.4813849Z   output_dir: .github/outputs
2023-10-18T16:10:07.4814322Z   output_renamed_files_as_deleted_and_added: false
2023-10-18T16:10:07.4814788Z   recover_deleted_files: false
2023-10-18T16:10:07.4815148Z   recover_files_separator: 

2023-10-18T16:10:07.4815522Z   recover_files_ignore_separator: 

2023-10-18T16:10:07.4816117Z   token: ***
2023-10-18T16:10:07.4816432Z   api_url: https://api.github.com
2023-10-18T16:10:07.4816839Z   fail_on_initial_diff_error: false
2023-10-18T16:10:07.4817246Z   fail_on_submodule_diff_error: false
2023-10-18T16:10:07.4817644Z ##[endgroup]
2023-10-18T16:10:07.6454989Z ##[group]changed-files
2023-10-18T16:10:07.6764557Z Using local .git directory
2023-10-18T16:10:07.7356952Z Running on a pull_request (synchronize) event...
2023-10-18T16:10:07.7358340Z Repository is shallow, fetching more history...
2023-10-18T16:10:07.7403840Z Completed fetching more history.
2023-10-18T16:10:07.7909870Z Retrieving changes between cd8701c20d911014c6ba63188bed505ebdda8376 (main) → 06014c2c7224d5c726abdcac6b550711a9e986eb (feature/DO-1568)
2023-10-18T16:10:07.7969305Z All Done!
2023-10-18T16:10:07.7970305Z ##[endgroup]
2023-10-18T16:10:07.7972680Z ##[group]changed-files-patterns
2023-10-18T16:10:07.8082647Z All Done!
2023-10-18T16:10:07.8083393Z ##[endgroup]
2023-10-18T16:10:07.8353554Z ##[group]Run echo ''
2023-10-18T16:10:07.8353936Z �[36;1mecho ''�[0m
2023-10-18T16:10:07.8405001Z shell: /usr/bin/bash -e {0}
2023-10-18T16:10:07.8405350Z ##[endgroup]

Has all relevant logs been included?

  • I've included all relevant logs

Anything else?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@nistalhelmuth nistalhelmuth added the bug Something isn't working label Oct 18, 2023
@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.

@jackton1
Copy link
Member

Hi @nistalhelmuth, the separator input controls the output fields for example get all list changed files and rather than space delimited output use comma.

For your use case you’ll need to specify the files_from_source_file_separator which correctly reads the files_from_source_file based on the specified separator.

You can always checkout the inputs section for more information.

@jackton1 jackton1 closed this as not planned Won't fix, can't repro, duplicate, stale Oct 18, 2023
@nistalhelmuth
Copy link
Author

Thanks for taking the time. Im sorry, I uploaded a wrong code snipped. Let me clarify:
I am using files_from_source_file_separator to specify comma but somehow is not working. You can also check that input in my Relevant Log Output section.

@jackton1
Copy link
Member

jackton1 commented Oct 19, 2023

Hi @nistalhelmuth Can you enable debug mode as there are vital information missing in the logs section. You can copy and paste the logs or download and upload them.

it’s also unclear what the bug is can you explain with examples I.e file names and what was returned. Thanks

@jackton1
Copy link
Member

jackton1 commented Oct 20, 2023

Actually related to this I checked the code and the separator are only used for inputs that are passed in e.g you have a comma separated list of files_from_source_file: .github/directories_list.txt, .github/directories2_list.txt .github/directories3_list.txt in which case the files_from_source_file_separator would be ,

Excerpt from the docs:

Separator used to split the files_from_source_file input

@jackton1
Copy link
Member

Is there a reason you want to read the separator in the file?

@nistalhelmuth
Copy link
Author

oh! now I see. My idea was to configure comma as a custom separator for the values listed in directories_list.txt, the current behavior forced me to add an additional step to format inputs before tj-actions/changed-files evaluate the repository. For now I will keep my workaround for practicity, I will leave the code sniped of what I'm doing in case is needed for someone else. Still thanks so much for your time.

      - name: Create file listing directorires to evaluate
        run: |
          for i in $(echo ${{ inputs.directories }} | sed "s/,/ /g")
          do
              echo $i >> .github/directories_list.txt
          done

      - name: Get changed files
        id: changed-files
        uses: tj-actions/changed-files@v39
        with:
          dir_names: true
          dir_names_max_depth: 2
          separator: ","
          files_from_source_file: .github/directories_list.txt

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