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] Directory name returned twice #2187

Closed
4 tasks done
gautiwiseis opened this issue Jul 9, 2024 · 2 comments
Closed
4 tasks done

[BUG] Directory name returned twice #2187

gautiwiseis opened this issue Jul 9, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@gautiwiseis
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?

When running the action on PR using dir_names: true we get the directory name that has the changed files returned twice. This only seems to happen in one of our repositories out of 100 or so using the action (as far as I have been made aware of).

The example run provided below has safe_output: false which is something I was testing and usually isn't in the workflow but doesn't affect that the directory name is being returned twice.

To Reproduce

Haven't been able to reproduce in other repos. I have however token the codebase from this repository, intialized a new repository, triggered the pipeline and have it happen again, so doesn't seem to have anything to do with the history perhaps containing a duplicate directory names.

What OS are you seeing the problem on?

ubuntu-latest or ubuntu-22.04

Expected behavior?

When making changes to some files located in
./app1

but not in

./app2

getting app1 as an output from the action using dir_names: true

Relevant log output

Here is an example of a workflow run with debugging enabled in which where the directory name is returned twice as well as an output printing of all the is returned from the action.

And here are the debug logs:
##[debug]Evaluating condition for step: 'Get changed directories'
##[debug]Evaluating: success()
##[debug]Evaluating success:
##[debug]=> true
##[debug]Result: true
##[debug]Starting: Get changed directories
##[debug]Loading inputs
##[debug]Evaluating: github.token
##[debug]Evaluating Index:
##[debug]..Evaluating github:
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'token'
##[debug]=> '***'
##[debug]Result: '***'
##[debug]Evaluating: github.api_url
##[debug]Evaluating Index:
##[debug]..Evaluating github:
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'api_url'
##[debug]=> 'https://api.github.com'
##[debug]Result: 'https://api.github.com'
##[debug]Loading env
Run tj-actions/changed-files@v44
  with:
    dir_names: true
    dir_names_max_depth: 1
    dir_names_exclude_current_dir: true
    safe_output: false
    matrix: true
    files_ignore: .github/**
  README.MD
  
    separator:  
    include_all_old_new_renamed_files: false
    old_new_separator: ,
    old_new_files_separator:  
    files_from_source_file_separator: 
  
    files_separator: 
  
    files_yaml_from_source_file_separator: 
  
    files_ignore_yaml_from_source_file_separator: 
  
    files_ignore_separator: 
  
    files_ignore_from_source_file_separator: 
  
    path: .
    quotepath: true
    diff_relative: true
    dir_names_include_files_separator: 
  
    dir_names_deleted_files_include_only_deleted_dirs: false
    json: false
    escape_json: true
    fetch_depth: 25
    skip_initial_fetch: false
    fetch_additional_submodule_history: false
    since_last_remote_commit: false
    write_output_files: false
    output_dir: .github/outputs
    output_renamed_files_as_deleted_and_added: false
    recover_deleted_files: false
    recover_files_separator: 
  
    recover_files_ignore_separator: 
  
    token: ***
    api_url: https://api.github.com
    use_rest_api: false
    fail_on_initial_diff_error: false
    fail_on_submodule_diff_error: false
    negation_patterns_first: false
    exclude_submodules: false
    fetch_missing_history_max_retries: 20
    use_posix_path_separator: false
    tags_pattern: *
::group::changed-files
changed-files
  ##[debug]Env: {
  ##[debug]  "GITHUB_REF_NAME": "7/merge",
  ##[debug]  "GITHUB_REF": "refs/pull/7/merge",
  ##[debug]  "GITHUB_WORKSPACE": "/home/runner/work/Ferdathjonusta_Baenda/Ferdathjonusta_Baenda"
  ##[debug]}
  ##[debug]Inputs: {
  ##[debug]  "files": "",
  ##[debug]  "filesSeparator": "\n",
  ##[debug]  "filesFromSourceFile": "",
  ##[debug]  "filesFromSourceFileSeparator": "\n",
  ##[debug]  "filesYaml": "",
  ##[debug]  "filesYamlFromSourceFile": "",
  ##[debug]  "filesYamlFromSourceFileSeparator": "\n",
  ##[debug]  "filesIgnore": ".github/**\nREADME.MD",
  ##[debug]  "filesIgnoreSeparator": "\n",
  ##[debug]  "filesIgnoreFromSourceFile": "",
  ##[debug]  "filesIgnoreFromSourceFileSeparator": "\n",
  ##[debug]  "filesIgnoreYaml": "",
  ##[debug]  "filesIgnoreYamlFromSourceFile": "",
  ##[debug]  "filesIgnoreYamlFromSourceFileSeparator": "\n",
  ##[debug]  "failOnInitialDiffError": false,
  ##[debug]  "failOnSubmoduleDiffError": false,
  ##[debug]  "separator": " ",
  ##[debug]  "sha": "",
  ##[debug]  "baseSha": "",
  ##[debug]  "since": "",
  ##[debug]  "until": "",
  ##[debug]  "path": ".",
  ##[debug]  "quotepath": true,
  ##[debug]  "diffRelative": true,
  ##[debug]  "sinceLastRemoteCommit": false,
  ##[debug]  "recoverDeletedFiles": false,
  ##[debug]  "recoverDeletedFilesToDestination": "",
  ##[debug]  "recoverFiles": "",
  ##[debug]  "recoverFilesSeparator": "\n",
  ##[debug]  "recoverFilesIgnore": "",
  ##[debug]  "recoverFilesIgnoreSeparator": "\n",
  ##[debug]  "includeAllOldNewRenamedFiles": false,
  ##[debug]  "oldNewSeparator": ",",
  ##[debug]  "oldNewFilesSeparator": " ",
  ##[debug]  "skipInitialFetch": false,
  ##[debug]  "fetchAdditionalSubmoduleHistory": false,
  ##[debug]  "dirNamesDeletedFilesIncludeOnlyDeletedDirs": false,
  ##[debug]  "excludeSubmodules": false,
  ##[debug]  "usePosixPathSeparator": false,
  ##[debug]  "tagsPattern": "*",
  ##[debug]  "tagsIgnorePattern": "",
  ##[debug]  "dirNames": true,
  ##[debug]  "dirNamesExcludeCurrentDir": true,
  ##[debug]  "dirNamesIncludeFiles": "",
  ##[debug]  "dirNamesIncludeFilesSeparator": "\n",
  ##[debug]  "json": true,
  ##[debug]  "escapeJson": false,
  ##[debug]  "safeOutput": false,
  ##[debug]  "writeOutputFiles": false,
  ##[debug]  "outputDir": ".github/outputs",
  ##[debug]  "outputRenamedFilesAsDeletedAndAdded": false,
  ##[debug]  "token": "***",
  ##[debug]  "apiUrl": "https://api.github.com",
  ##[debug]  "negationPatternsFirst": false,
  ##[debug]  "useRestApi": false,
  ##[debug]  "fetchDepth": 25,
  ##[debug]  "dirNamesMaxDepth": 1,
  ##[debug]  "fetchMissingHistoryMaxRetries": 20
  ##[debug]}
  ##[debug]Working directory: /home/runner/work/Ferdathjonusta_Baenda/Ferdathjonusta_Baenda
  /usr/bin/git rev-parse --is-inside-work-tree
  true
  ##[debug]Has git directory: true
  ##[debug]files ignore patterns: !.github/**
  ##[debug]!README.MD
  ##[debug]Input file patterns: 
  ##[debug]!.github/**
  ##[debug]!README.MD
  ##[debug]File patterns: !.github/**,!README.MD
  ##[debug]Yaml file patterns: {}
  Using local .git directory
  /usr/bin/git --version
  git version 2.45.2
  /usr/bin/git config --global core.quotepath on
  /usr/bin/git config --global diff.relative true
  /usr/bin/git rev-parse --is-shallow-repository
  true
  /usr/bin/git submodule status
  Running on a pull_request (opened) event...
  Repository is shallow, fetching more history...
  /usr/bin/git fetch -q --no-tags --prune -u --progress origin pull/7/head:testing-pipeline
  remote: Enumerating objects: 73, done.        
  remote: Counting objects:   1% (1/73)        
  remote: Compressing objects:  98% (97/98)        
  remote: Compressing objects: 100% (98/98)        
  remote: Compressing objects: 100% (98/98), done.        
  remote: Total 134 (delta 80), reused 61 (delta 27), pack-reused 0        
  Completed fetching more history.
  ##[debug]Getting current SHA...
  /usr/bin/git rev-parse --verify c8d9fc93723fd1bbb19eb3ddece3c9a695f6c53e^{commit}
  c8d9fc93723fd1bbb19eb3ddece3c9a695f6c53e
  /usr/bin/git rev-parse --verify c8d9fc93723fd1bbb19eb3ddece3c9a695f6c53e^{commit}
  c8d9fc93723fd1bbb19eb3ddece3c9a695f6c53e
  ##[debug]Current SHA: c8d9fc93723fd1bbb19eb3ddece3c9a695f6c53e
  /usr/bin/git merge-base 1b7e9b7aca3a87b25e22f28e46788d05dbfe29cf c8d9fc93723fd1bbb19eb3ddece3c9a695f6c53e
  1b7e9b7aca3a87b25e22f28e46788d05dbfe29cf
  /usr/bin/git log --format=%H 1b7e9b7aca3a87b25e22f28e46788d05dbfe29cf..c8d9fc93723fd1bbb19eb3ddece3c9a695f6c53e
  c8d9fc93723fd1bbb19eb3ddece3c9a695f6c53e
  f11b05428d7cda8bdc94567a2a174a3871709d2c
  /usr/bin/git merge-base 1b7e9b7aca3a87b25e22f28e46788d05dbfe29cf c8d9fc93723fd1bbb19eb3ddece3c9a695f6c53e
  1b7e9b7aca3a87b25e22f28e46788d05dbfe29cf
  /usr/bin/git log --format=%H 1b7e9b7aca3a87b25e22f28e46788d05dbfe29cf..c8d9fc93723fd1bbb19eb3ddece3c9a695f6c53e
  c8d9fc93723fd1bbb19eb3ddece3c9a695f6c53e
  f11b05428d7cda8bdc94567a2a174a3871709d2c
  /usr/bin/git rev-parse --verify 1b7e9b7aca3a87b25e22f28e46788d05dbfe29cf^{commit}
  1b7e9b7aca3a87b25e22f28e46788d05dbfe29cf
  ##[debug]Previous SHA: 1b7e9b7aca3a87b25e22f28e46788d05dbfe29cf
  /usr/bin/git merge-base 1b7e9b7aca3a87b25e22f28e46788d05dbfe29cf c8d9fc93723fd1bbb19eb3ddece3c9a695f6c53e
  1b7e9b7aca3a87b25e22f28e46788d05dbfe29cf
  /usr/bin/git log --format=%H 1b7e9b7aca3a87b25e22f28e46788d05dbfe29cf..c8d9fc93723fd1bbb19eb3ddece3c9a695f6c53e
  c8d9fc93723fd1bbb19eb3ddece3c9a695f6c53e
  f11b05428d7cda8bdc94567a2a174a3871709d2c
  Retrieving changes between 1b7e9b7aca3a87b25e22f28e46788d05dbfe29cf (dev) → c8d9fc93723fd1bbb19eb3ddece3c9a695f6c53e (testing-pipeline)
  /usr/bin/git diff --name-status --ignore-submodules=all --diff-filter=ACDMRTUX 1b7e9b7aca3a87b25e22f28e46788d05dbfe29cf...c8d9fc93723fd1bbb19eb3ddece3c9a695f6c53e
  M	.github/workflows/compile-on-pr.yml
  M	FerdathjonustaBaenda/Src/API/PTEJournalLinesAPI.Page.al
  M	"FerdathjonustaBaenda/Translations/Fer\303\260a\303\276j\303\263nusta B\303\246nda Customizations.g.xlf"
  M	"FerdathjonustaBaenda/Translations/Fer\303\260a\303\276j\303\263nusta B\303\246nda Customizations.is-IS.xlf"
  ##[debug]All diff files: {"A":[],"C":[],"D":[],"M":[".github/workflows/compile-on-pr.yml","FerdathjonustaBaenda/Src/API/PTEJournalLinesAPI.Page.al","\"FerdathjonustaBaenda/Translations/Fer\\303\\260a\\303\\276j\\303\\263nusta B\\303\\246nda Customizations.g.xlf\"","\"FerdathjonustaBaenda/Translations/Fer\\303\\260a\\303\\276j\\303\\263nusta B\\303\\246nda Customizations.is-IS.xlf\""],"R":[],"T":[],"U":[],"X":[]}
  All Done!
  ::endgroup::
::group::changed-files-patterns
changed-files-patterns
  ##[debug]All filtered diff files: {"A":[],"C":[],"D":[],"M":["FerdathjonustaBaenda/Src/API/PTEJournalLinesAPI.Page.al","\"FerdathjonustaBaenda/Translations/Fer\\303\\260a\\303\\276j\\303\\263nusta B\\303\\246nda Customizations.g.xlf\"","\"FerdathjonustaBaenda/Translations/Fer\\303\\260a\\303\\276j\\303\\263nusta B\\303\\246nda Customizations.is-IS.xlf\""],"R":[],"T":[],"U":[],"X":[]}
  ##[debug]Dir names include file patterns: []
  ##[debug]Added files: {"paths":[],"count":"0"}
  ##[debug]Dir names include file patterns: []
  ##[debug]Copied files: {"paths":[],"count":"0"}
  ##[debug]Dir names include file patterns: []
  ##[debug]Modified files: {"paths":["FerdathjonustaBaenda","\"FerdathjonustaBaenda"],"count":"2"}
  ##[debug]Dir names include file patterns: []
  ##[debug]Renamed files: {"paths":[],"count":"0"}
  ##[debug]Dir names include file patterns: []
  ##[debug]Type changed files: {"paths":[],"count":"0"}
  ##[debug]Dir names include file patterns: []
  ##[debug]Unmerged files: {"paths":[],"count":"0"}
  ##[debug]Dir names include file patterns: []
  ##[debug]Unknown files: {"paths":[],"count":"0"}
  ##[debug]Dir names include file patterns: []
  ##[debug]All changed and modified files: {"paths":["FerdathjonustaBaenda","\"FerdathjonustaBaenda"],"count":"2"}
  ##[debug]Dir names include file patterns: []
  ##[debug]All changed files: {"paths":["FerdathjonustaBaenda","\"FerdathjonustaBaenda"],"count":"2"}
  ##[debug]Dir names include file patterns: []
  ##[debug]All other changed files: {"paths":[".github","FerdathjonustaBaenda","\"FerdathjonustaBaenda"],"count":"3"}
  ##[debug]other_changed_files: [".github"]
  ##[debug]Dir names include file patterns: []
  ##[debug]All modified files: {"paths":["FerdathjonustaBaenda","\"FerdathjonustaBaenda"],"count":"2"}
  ##[debug]Dir names include file patterns: []
  ##[debug]other_modified_files: [".github"]
  ##[debug]Dir names include file patterns: []
  ##[debug]Deleted files: {"paths":[],"count":"0"}
  ##[debug]Dir names include file patterns: []
  ##[debug]other_deleted_files: []
  All Done!
  ::endgroup::
##[debug]Node Action run completed with exit code 0
##[debug]Set output added_files = []
##[debug]Set output added_files_count = 0
##[debug]Set output copied_files = []
##[debug]Set output copied_files_count = 0
##[debug]Set output modified_files = ["FerdathjonustaBaenda","\"FerdathjonustaBaenda"]
##[debug]Set output modified_files_count = 2
##[debug]Set output renamed_files = []
##[debug]Set output renamed_files_count = 0
##[debug]Set output type_changed_files = []
##[debug]Set output type_changed_files_count = 0
##[debug]Set output unmerged_files = []
##[debug]Set output unmerged_files_count = 0
##[debug]Set output unknown_files = []
##[debug]Set output unknown_files_count = 0
##[debug]Set output all_changed_and_modified_files = ["FerdathjonustaBaenda","\"FerdathjonustaBaenda"]
##[debug]Set output all_changed_and_modified_files_count = 2
##[debug]Set output all_changed_files = ["FerdathjonustaBaenda","\"FerdathjonustaBaenda"]
##[debug]Set output all_changed_files_count = 2
##[debug]Set output any_changed = true
##[debug]Set output only_changed = false
##[debug]Set output other_changed_files = [".github"]
##[debug]Set output other_changed_files_count = 1
##[debug]Set output all_modified_files = ["FerdathjonustaBaenda","\"FerdathjonustaBaenda"]
##[debug]Set output all_modified_files_count = 2
##[debug]Set output any_modified = true
##[debug]Set output only_modified = false
##[debug]Set output other_modified_files = [".github"]
##[debug]Set output other_modified_files_count = 1
##[debug]Set output deleted_files = []
##[debug]Set output deleted_files_count = 0
##[debug]Set output any_deleted = false
##[debug]Set output only_deleted = false
##[debug]Set output other_deleted_files = []
##[debug]Set output other_deleted_files_count = 0
##[debug]Finishing: Get changed directories

Has all relevant logs been included?

  • I've included all relevant logs

Anything else?

The relevant steps in my workflow from where the debug logs are from. The log example is from a workflow triggered by a pull request being synchronized:

`jobs:
Get-Changed-Directories:
name: Get Changed Directories
runs-on: ubuntu-latest
outputs:
any_changed: ${{ steps.changed_dirs.outputs.any_changed }}
all_changed_files: ${{ steps.changed_dirs.outputs.all_changed_files }}
dirs: ${{ steps.set_output.outputs.dirs }}
steps:
- name: Check out code
uses: actions/checkout@v4
with:
# ref head_sha so it can correctly detect changes from the PR
ref: ${{ github.event.pull_request.head.sha }}

  - name: Get changed directories
    id: changed_dirs
    uses: tj-actions/changed-files@v44
    with:
      dir_names: true
      dir_names_max_depth: "1"
      dir_names_exclude_current_dir: true
      safe_output: false 
      matrix: true
      files_ignore: |
        .github/**
        README.MD
  - name: Show all output
    run: |
      echo "${{ toJSON(steps.changed_dirs.outputs) }}"
    shell: bash`

Code of Conduct

  • I agree to follow this project's Code of Conduct
@gautiwiseis gautiwiseis added the bug Something isn't working label Jul 9, 2024
@tj-actions-bot
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.

@gautiwiseis
Copy link
Author

So when going again over the debug logs I noticed that it seems to be wrapping some of the files in quotes to handle them having special characters in their name:
image

Fixing /changing the file names to English fixed this so only one directory name got returned. So in my case the issue is fixed but perhaps this is something that you would want to support. But closing the issue for now.

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