-
-
Notifications
You must be signed in to change notification settings - Fork 323
Description
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?
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
| 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 directoryHas 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