tj-actions / changed-files

:octocat: Github action to retrieve all (added, copied, modified, deleted, renamed, type changed, unmerged, unknown) files and directories.
MIT License
1.84k stars 191 forks source link

[BUG] When using any yaml input for file reference, `all_changed_files` value is not returned #2346

Closed csaba-almasi-neonomics closed 10 hours ago

csaba-almasi-neonomics commented 1 day ago

Is there an existing issue for this?

Does this issue exist in the latest version?

Describe the bug?

When using files_yaml_from_source_file or files_yaml input , standard outputs like all_changed_files is not returned.

Sample workflow file

jobs:
  fetch_changed_modules:
    permissions:
      contents: "read"
    runs-on: ubuntu-22.04
    outputs:
      changed_module_folders: ${{ steps.changed_directories.outputs.all_modified_files}}
    # Get all directories that contain module code
    steps:
      - uses: actions/checkout@v4
      - id: changed_directories
        # semver 45.0.0
        uses: tj-actions/changed-files@40853de9f8ce2d6cfdc73c1b96f14e22ba44aec4
        env:
          DEBUG: true
        with:
          # This glob pattern finds all files in the submodules from the root of the repository, filters md files and the .github folder"
          files_yaml_from_source_file: |
            .github/workflows/config/changed-files.yaml
          matrix: true
          dir_names: true

The output is:

Run echo "Changed Keys:"
Changed Keys:
[base_modules,connectors,parent]
Changed Files:

So the issue is not in the changed-files.yaml config. Is this the expected behavior here? I read through the documentation thoroughly and have seen no reference to outher outputs being absent when using the yaml based file input approach. Referencing the job output in subsequent jobs also yields '' which signals that the output is null or empty.

When looking at debug logs I do see base_modules_modified_files and similar outputs.

Why is this a problem?

If there is no globally returned changed file list, I have to set the outputs for the job one-by-one for each key in the yaml config

To Reproduce

Using the files_yaml or files_yaml_from_source_file with any configuration will yield the same result.

What OS are you seeing the problem on?

ubuntu-latest or ubuntu-22.04

Expected behavior?

Either: A. The action output is there for all_changed_files or similar B. There is a an output that handles changed files based on the associated keys such as

{
base_modules : [STRING ARRAY OF CHANGED FILES],
....
}

C. It is documented that using the above mentioned inputs only yields changed_keys output and yaml key specific outputs like base_modules_modified_files etc.

Relevant log output

##[debug]Evaluating condition for step: 'Run tj-actions/changed-files@40853de9f8ce2d6cfdc73c1b96f14e22ba44aec4'
##[debug]Evaluating: success()
##[debug]Evaluating success:
##[debug]=> true
##[debug]Result: true
##[debug]Starting: Run tj-actions/changed-files@40853de9f8ce2d6cfdc73c1b96f14e22ba44aec4
##[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@40853de9f8ce2d6cfdc73c1b96f14e22ba44aec4
::group::changed-files
changed-files
::group::changed-files-yaml-base_modules
changed-files-yaml-base_modules
::group::changed-files-yaml-connectors
changed-files-yaml-connectors
::group::changed-files-yaml-parent
changed-files-yaml-parent
##[debug]modified_keys: ["base_modules","connectors","parent"]
##[debug]changed_keys: ["base_modules","connectors","parent"]
##[debug]Node Action run completed with exit code 0
##[debug]Set output base_modules_added_files = []
##[debug]Set output base_modules_added_files_count = 0
##[debug]Set output base_modules_copied_files = []
##[debug]Set output base_modules_copied_files_count = 0
##[debug]Set output base_modules_modified_files = ["connector-core/src/main/java/io/neonomics/connector/core/config","connector-common/src/main/java/io/neonomics/connector/common/config"]
##[debug]Set output base_modules_modified_files_count = 2
##[debug]Set output base_modules_renamed_files = []
##[debug]Set output base_modules_renamed_files_count = 0
##[debug]Set output base_modules_type_changed_files = []
##[debug]Set output base_modules_type_changed_files_count = 0
##[debug]Set output base_modules_unmerged_files = []
##[debug]Set output base_modules_unmerged_files_count = 0
##[debug]Set output base_modules_unknown_files = []
##[debug]Set output base_modules_unknown_files_count = 0
##[debug]Set output base_modules_all_changed_and_modified_files = ["connector-core/src/main/java/io/neonomics/connector/core/config","connector-common/src/main/java/io/neonomics/connector/common/config"]
##[debug]Set output base_modules_all_changed_and_modified_files_count = 2
##[debug]Set output base_modules_all_changed_files = ["connector-core/src/main/java/io/neonomics/connector/core/config","connector-common/src/main/java/io/neonomics/connector/common/config"]
##[debug]Set output base_modules_all_changed_files_count = 2
##[debug]Set output base_modules_any_changed = true
##[debug]Set output base_modules_only_changed = false
##[debug]Set output base_modules_other_changed_files = ["connectors/dnb-connector/src/main/java/io/neonomics/connector/dnb/ais/data","."]
##[debug]Set output base_modules_other_changed_files_count = 2
##[debug]Set output base_modules_all_modified_files = ["connector-core/src/main/java/io/neonomics/connector/core/config","connector-common/src/main/java/io/neonomics/connector/common/config"]
##[debug]Set output base_modules_all_modified_files_count = 2
##[debug]Set output base_modules_any_modified = true
##[debug]Set output base_modules_only_modified = false
##[debug]Set output base_modules_other_modified_files = ["connectors/dnb-connector/src/main/java/io/neonomics/connector/dnb/ais/data","."]
##[debug]Set output base_modules_other_modified_files_count = 2
##[debug]Set output base_modules_deleted_files = []
##[debug]Set output base_modules_deleted_files_count = 0
##[debug]Set output base_modules_any_deleted = false
##[debug]Set output base_modules_only_deleted = false
##[debug]Set output base_modules_other_deleted_files = []
##[debug]Set output base_modules_other_deleted_files_count = 0
##[debug]Set output connectors_added_files = []
##[debug]Set output connectors_added_files_count = 0
##[debug]Set output connectors_copied_files = []
##[debug]Set output connectors_copied_files_count = 0
##[debug]Set output connectors_modified_files = ["connectors/dnb-connector/src/main/java/io/neonomics/connector/dnb/ais/data"]
##[debug]Set output connectors_modified_files_count = 1
##[debug]Set output connectors_renamed_files = []
##[debug]Set output connectors_renamed_files_count = 0
##[debug]Set output connectors_type_changed_files = []
##[debug]Set output connectors_type_changed_files_count = 0
##[debug]Set output connectors_unmerged_files = []
##[debug]Set output connectors_unmerged_files_count = 0
##[debug]Set output connectors_unknown_files = []
##[debug]Set output connectors_unknown_files_count = 0
##[debug]Set output connectors_all_changed_and_modified_files = ["connectors/dnb-connector/src/main/java/io/neonomics/connector/dnb/ais/data"]
##[debug]Set output connectors_all_changed_and_modified_files_count = 1
##[debug]Set output connectors_all_changed_files = ["connectors/dnb-connector/src/main/java/io/neonomics/connector/dnb/ais/data"]
##[debug]Set output connectors_all_changed_files_count = 1
##[debug]Set output connectors_any_changed = true
##[debug]Set output connectors_only_changed = false
##[debug]Set output connectors_other_changed_files = ["connector-common/src/main/java/io/neonomics/connector/common/config","connector-core/src/main/java/io/neonomics/connector/core/config","."]
##[debug]Set output connectors_other_changed_files_count = 3
##[debug]Set output connectors_all_modified_files = ["connectors/dnb-connector/src/main/java/io/neonomics/connector/dnb/ais/data"]
##[debug]Set output connectors_all_modified_files_count = 1
##[debug]Set output connectors_any_modified = true
##[debug]Set output connectors_only_modified = false
##[debug]Set output connectors_other_modified_files = ["connector-common/src/main/java/io/neonomics/connector/common/config","connector-core/src/main/java/io/neonomics/connector/core/config","."]
##[debug]Set output connectors_other_modified_files_count = 3
##[debug]Set output connectors_deleted_files = []
##[debug]Set output connectors_deleted_files_count = 0
##[debug]Set output connectors_any_deleted = false
##[debug]Set output connectors_only_deleted = false
##[debug]Set output connectors_other_deleted_files = []
##[debug]Set output connectors_other_deleted_files_count = 0
##[debug]Set output parent_added_files = []
##[debug]Set output parent_added_files_count = 0
##[debug]Set output parent_copied_files = []
##[debug]Set output parent_copied_files_count = 0
##[debug]Set output parent_modified_files = ["."]
##[debug]Set output parent_modified_files_count = 1
##[debug]Set output parent_renamed_files = []
##[debug]Set output parent_renamed_files_count = 0
##[debug]Set output parent_type_changed_files = []
##[debug]Set output parent_type_changed_files_count = 0
##[debug]Set output parent_unmerged_files = []
##[debug]Set output parent_unmerged_files_count = 0
##[debug]Set output parent_unknown_files = []
##[debug]Set output parent_unknown_files_count = 0
##[debug]Set output parent_all_changed_and_modified_files = ["."]
##[debug]Set output parent_all_changed_and_modified_files_count = 1
##[debug]Set output parent_all_changed_files = ["."]
##[debug]Set output parent_all_changed_files_count = 1
##[debug]Set output parent_any_changed = true
##[debug]Set output parent_only_changed = false
##[debug]Set output parent_other_changed_files = ["connector-common/src/main/java/io/neonomics/connector/common/config","connector-core/src/main/java/io/neonomics/connector/core/config","connectors/dnb-connector/src/main/java/io/neonomics/connector/dnb/ais/data"]
##[debug]Set output parent_other_changed_files_count = 3
##[debug]Set output parent_all_modified_files = ["."]
##[debug]Set output parent_all_modified_files_count = 1
##[debug]Set output parent_any_modified = true
##[debug]Set output parent_only_modified = false
##[debug]Set output parent_other_modified_files = ["connector-common/src/main/java/io/neonomics/connector/common/config","connector-core/src/main/java/io/neonomics/connector/core/config","connectors/dnb-connector/src/main/java/io/neonomics/connector/dnb/ais/data"]
##[debug]Set output parent_other_modified_files_count = 3
##[debug]Set output parent_deleted_files = []
##[debug]Set output parent_deleted_files_count = 0
##[debug]Set output parent_any_deleted = false
##[debug]Set output parent_only_deleted = false
##[debug]Set output parent_other_deleted_files = []
##[debug]Set output parent_other_deleted_files_count = 0
##[debug]Set output modified_keys = ["base_modules","connectors","parent"]
##[debug]Set output changed_keys = ["base_modules","connectors","parent"]
##[debug]Finishing: Run tj-actions/changed-files@40853de9f8ce2d6cfdc73c1b96f14e22ba44aec4

Has all relevant logs been included?

Code of Conduct

tj-actions-bot commented 1 day ago

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

alina-dm commented 17 hours ago

+1

jackton1 commented 10 hours ago

Hi @csaba-almasi-neonomics, according to the documentation, if you use files_yaml* input, the outputs will be prefixed by the keys you specified, so you would need to change.

-- changed_module_folders: ${{ steps.changed_directories.outputs.all_modified_files}}
++ changed_module_folders: ${{ steps.changed_directories.outputs.base_modules_all_modified_files}}

For more information view the documentation here

Screenshot 2024-11-13 at 6 59 14 AM