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 directory matching doesn't match #2273

Closed
4 tasks done
alex8bitw opened this issue Sep 10, 2024 · 6 comments
Closed
4 tasks done

[BUG] Glob directory matching doesn't match #2273

alex8bitw opened this issue Sep 10, 2024 · 6 comments
Labels
bug Something isn't working

Comments

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

jobs:
  configure:
    permissions: write-all
    runs-on: ubuntu-latest
    outputs:
      HONO_JSON: ${{ steps.preconfig.outputs.hono_json }}
      GHPR: ${{ github.event.number }}
    steps:
      - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332  # v4.1.7
        with:
          fetch-depth: 0

      - name: Get changed files
        id: changed-files
        uses: tj-actions/changed-files@e9772d140489982e0e3704fea5ee93d536f1e275  # v45.0.1
        with:
          dir_names: 'true'
          dir_names_exclude_current_dir: 'true'
          dir_names_max_depth: '3'
          json: 'true'
          dir_names_include_files: |
            **/*hono*

      - name: PreConfig
        id: preconfig
        env:
          HONO_JSON: ${{ steps.changed-files.outputs.all_changed_files }}
          GH_TOKEN: ${{ github.token }}
        run: |
          echo "ENV: [HONO_JSON] ${HONO_JSON}"
          if [[ -z ${HONO_JSON} ]]; then
            echo "HONO_JSON Empty. No changes detected." 
            exit 1
          fi
          echo "hono_json=${HONO_JSON}" >> $GITHUB_OUTPUT

We get this output: [".github/workflows","nonprod/usdev/hono-usdev"]

Testing with https://codepen.io/mrmlnc/pen/OXQjMe
We see that it should work:
image

To Reproduce

Use **/ glob with the config above.

What OS are you seeing the problem on?

ubuntu-latest or ubuntu-22.04

Expected behavior?

["nonprod/usdev/hono-usdev"]

Relevant log output

2024-09-10T10:46:58.1134962Z [command]/usr/bin/git log -1 --format='%H'
2024-09-10T10:46:58.1155260Z 'd8dee9d309753cc2ce2d0b5a15f737dd6c57145b'
2024-09-10T10:46:58.1580843Z ##[group]Run tj-actions/changed-files@e9772d140489982e0e3704fea5ee93d536f1e275
2024-09-10T10:46:58.1581573Z with:
2024-09-10T10:46:58.1581901Z   dir_names: true
2024-09-10T10:46:58.1582410Z   dir_names_exclude_current_dir: false
2024-09-10T10:46:58.1582843Z   dir_names_max_depth: 3
2024-09-10T10:46:58.1583217Z   json: true
2024-09-10T10:46:58.1583652Z   dir_names_include_files: **/*hono*

2024-09-10T10:46:58.1584060Z   separator:  
2024-09-10T10:46:58.1584442Z   include_all_old_new_renamed_files: false
2024-09-10T10:46:58.1585050Z   old_new_separator: ,
2024-09-10T10:46:58.1585414Z   old_new_files_separator:  
2024-09-10T10:46:58.1585864Z   files_from_source_file_separator: 

2024-09-10T10:46:58.1586380Z   files_separator: 

2024-09-10T10:46:58.1586749Z   files_yaml_from_source_file_separator: 

2024-09-10T10:46:58.1587305Z   files_ignore_yaml_from_source_file_separator: 

2024-09-10T10:46:58.1587885Z   files_ignore_separator: 

2024-09-10T10:46:58.1588422Z   files_ignore_from_source_file_separator: 

2024-09-10T10:46:58.1588956Z   path: .
2024-09-10T10:46:58.1589275Z   quotepath: true
2024-09-10T10:46:58.1589612Z   diff_relative: true
2024-09-10T10:46:58.1590079Z   dir_names_include_files_separator: 

2024-09-10T10:46:58.1590648Z   dir_names_deleted_files_include_only_deleted_dirs: false
2024-09-10T10:46:58.1591175Z   escape_json: true
2024-09-10T10:46:58.1591608Z   safe_output: true
2024-09-10T10:46:58.1591993Z   fetch_depth: 25
2024-09-10T10:46:58.1592349Z   skip_initial_fetch: false
2024-09-10T10:46:58.1593138Z   fetch_additional_submodule_history: false
2024-09-10T10:46:58.1593679Z   since_last_remote_commit: false
2024-09-10T10:46:58.1594087Z   write_output_files: false
2024-09-10T10:46:58.1594567Z   output_dir: .github/outputs
2024-09-10T10:46:58.1595058Z   output_renamed_files_as_deleted_and_added: false
2024-09-10T10:46:58.1595687Z   recover_deleted_files: false
2024-09-10T10:46:58.1596157Z   recover_files_separator: 

2024-09-10T10:46:58.1596622Z   recover_files_ignore_separator: 

2024-09-10T10:46:58.1597240Z   token: ***
2024-09-10T10:46:58.1597655Z   api_url: https://api.github.com
2024-09-10T10:46:58.1598361Z   use_rest_api: false
2024-09-10T10:46:58.1598859Z   fail_on_initial_diff_error: false
2024-09-10T10:46:58.1599409Z   fail_on_submodule_diff_error: false
2024-09-10T10:46:58.1599894Z   negation_patterns_first: false
2024-09-10T10:46:58.1600317Z   matrix: false
2024-09-10T10:46:58.1600726Z   exclude_submodules: false
2024-09-10T10:46:58.1601153Z   fetch_missing_history_max_retries: 20
2024-09-10T10:46:58.1601639Z   use_posix_path_separator: false
2024-09-10T10:46:58.1602396Z   tags_pattern: *
2024-09-10T10:46:58.1602787Z ##[endgroup]
2024-09-10T10:46:58.2827850Z ##[group]changed-files
2024-09-10T10:46:58.2964834Z Using local .git directory
2024-09-10T10:46:58.3499931Z Running on a pull_request (synchronize) event...
2024-09-10T10:46:58.3501055Z Repository is shallow, fetching more history...
2024-09-10T10:46:58.3502745Z Completed fetching more history.
2024-09-10T10:46:58.3905314Z Retrieving changes between 5574b1aaf3d278edcc3e9a5c71e1f7682d5819ac (main) → 6128707b21392c1ec3731710ae68614f25c947e2 (SRE-589_CICD_Testing6)
2024-09-10T10:46:58.3963480Z All Done!
2024-09-10T10:46:58.3967647Z ##[endgroup]
2024-09-10T10:46:58.3970010Z ##[group]changed-files-all
2024-09-10T10:46:58.4084636Z All Done!
2024-09-10T10:46:58.4085686Z ##[endgroup]
2024-09-10T10:46:58.4250612Z ##[group]Run echo "ENV: [HONO_JSON] ${HONO_JSON}"
2024-09-10T10:46:58.4251402Z �[36;1mecho "ENV: [HONO_JSON] ${HONO_JSON}"�[0m
2024-09-10T10:46:58.4252152Z �[36;1mif [[ -z ${HONO_JSON} ]]; then�[0m
2024-09-10T10:46:58.4252725Z �[36;1m  echo "HONO_JSON Empty. No changes detected." �[0m
2024-09-10T10:46:58.4253287Z �[36;1m  exit 1�[0m
2024-09-10T10:46:58.4253730Z �[36;1mfi�[0m
2024-09-10T10:46:58.4254137Z �[36;1mecho "hono_json=${HONO_JSON}" >> $GITHUB_OUTPUT�[0m
2024-09-10T10:46:58.4281394Z shell: /usr/bin/bash -e {0}
2024-09-10T10:46:58.4281830Z env:
2024-09-10T10:46:58.4283930Z   HONO_JSON: [\".github/workflows\",\"nonprod/usdev/hono-usdev\"]
2024-09-10T10:46:58.4285291Z   GH_TOKEN: ***
2024-09-10T10:46:58.4285715Z ##[endgroup]
2024-09-10T10:46:58.4411940Z ENV: [HONO_JSON] [\".github/workflows\",\"nonprod/usdev/hono-usdev\"]
2024-09-10T10:46:58.4513592Z Post job cleanup.
2024-09-10T10:46:58.5491447Z [command]/usr/bin/git version
2024-09-10T10:46:58.5545422Z git version 2.46.0

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
@alex8bitw alex8bitw added the bug Something isn't working label Sep 10, 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.

@jackton1
Copy link
Member

jackton1 commented Sep 10, 2024

Hi @alex8bitw, I believe this issue is due to a misunderstanding of the dir_names_include_files input. This filter is primarily used to filter files within a directory and return that directory. If you intend to only consider directories that include hono, you'll need to use the files input instead.

      - name: Get changed files
        id: changed-files
        uses: tj-actions/changed-files@e9772d140489982e0e3704fea5ee93d536f1e275  # v45.0.1
        with:
          files: |
            **/*hono*
          dir_names: 'true'
          dir_names_exclude_current_dir: 'true'
          dir_names_max_depth: '3'
          json: 'true'

For some context on the intended use, see: #1447

@alex8bitw
Copy link
Author

alex8bitw commented Sep 11, 2024

I don't believe #1447 is related to this. I'm not looking for files changed, I'm only looking for directories that have changed. Neither works as intended.

Not this:

          dir_names_include_files: |
            **/*hono*

Nor this:

files: |
           **/*hono*

@alex8bitw
Copy link
Author

I tested again, what actually happens is that files: returns absolutely nothing.

@alex8bitw
Copy link
Author

@jackton1 please re-open the issue. files: doesn't work either.

@jackton1
Copy link
Member

jackton1 commented Sep 11, 2024

Hi @alex8bitw, can you provide the related logs and also include the filenames that were changed in the .github/workflows directory? Note that your **/*hono* filter pattern is likely matching files within the .github/workflows folder.

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

3 participants