Is there an existing issue for this?
Does this issue exist in the latest version?
Describe the bug?
According to the docs, modified_keys and changed_keys. However, when no changes are detected they are not set at all:
|
if (modifiedKeys.length > 0) { |
|
await setArrayOutput({ |
|
key: 'modified_keys', |
|
inputs, |
|
value: modifiedKeys |
|
}) |
|
} |
|
|
|
if (changedKeys.length > 0) { |
|
await setArrayOutput({ |
|
key: 'changed_keys', |
|
inputs, |
|
value: changedKeys |
|
}) |
|
} |
|
} |
This requires custom handling of these outputs (checking for their presence etc.) Instead they should be always set, in case of no changes they would be just empty lists and they could be handled consistently like any other list.
To Reproduce
E.g. in a repository with some files (e.g. a.txt, b.txt and c.txt) run this action with the following setup:
name: Check changed files
uses: tj-actions/changed-files@e9772d140489982e0e3704fea5ee93d536f1e275 # v45.0.1
with:
files_yaml: |
a:
- a.txt
b:
- b.txt
json: true
escape_json: false
write_output_files: true
output_dir: ${{ runner.temp }}/changed-files
And create a PR that changes only c.txt. As a result, the changed-files step won't create ${{ runner.temp }}/changed-files/modified_keys.json and ${{ runner.temp }}/changed-files/changed_keys.json files.
What OS are you seeing the problem on?
ubuntu-latest or ubuntu-22.04
Expected behavior?
changed_keys and modified_keys are always set, even though they would be empty lists.
Relevant log output
error: Could not open file /runner/_work/_temp/changed-files/modified_keys.json: No such file or directory
Has all relevant logs been included?
Anything else?
No response
Code of Conduct
Is there an existing issue for this?
Does this issue exist in the latest version?
Describe the bug?
According to the docs, modified_keys and changed_keys. However, when no changes are detected they are not set at all:
changed-files/src/changedFiles.ts
Lines 92 to 107 in 315505a
This requires custom handling of these outputs (checking for their presence etc.) Instead they should be always set, in case of no changes they would be just empty lists and they could be handled consistently like any other list.
To Reproduce
E.g. in a repository with some files (e.g. a.txt, b.txt and c.txt) run this action with the following setup:
And create a PR that changes only
c.txt. As a result, the changed-files step won't create${{ runner.temp }}/changed-files/modified_keys.jsonand${{ runner.temp }}/changed-files/changed_keys.jsonfiles.What OS are you seeing the problem on?
ubuntu-latest or ubuntu-22.04
Expected behavior?
changed_keysandmodified_keysare always set, even though they would be empty lists.Relevant log output
Has all relevant logs been included?
Anything else?
No response
Code of Conduct