Description: We are experiencing the following error in the GitHub Action for mod_scormremote.
Warning: Unable to locate the previous sha: 37eed5f223c5d48a8a34566aef4faa4a254a212e
Warning: You seem to be missing 'fetch-depth: 0' or 'fetch-depth: 2'. See https://github.com/tj-actions/changed-files#usage
Error: Process completed with exit code 1.
The issue appears to be occurring due to this step/line of CI.ymlhere
- name: Check out plugin code
uses: actions/checkout@v3
with:
# Needed for 'changed-files' actions (alternatively could be a fixed
# large number but may cause issues if limited).
----> fetch-depth: ${{ ((contains(github.event_name, 'push') && steps.check-branch.outputs.publishable == 'true')) && 0 || 2 }}
path: plugin
submodules: true
Currently, the fetch-depth conditional is not being evaluated correctly. It uses a ternary operator and so if both contains(github.event_name, 'push') and steps.check-branch.outputs.publishable == 'true' are true, it should return 0. However, it is returning 2 as seen in the debug logs below:
It is altering the conditional by moving the closing brace to surround the 0 as well so that the only possible result to return is 2. This means that this step is only fetching the latest two commits. In the case of mod_scormremote, fetching only the last two commits is not enough to find previous SHA 37eed5f
Note that setting fetch-depth to 0 is recommended here
Description: We are experiencing the following error in the GitHub Action for mod_scormremote.
The issue appears to be occurring due to this step/line of
CI.yml
hereCurrently, the
fetch-depth
conditional is not being evaluated correctly. It uses a ternary operator and so if bothcontains(github.event_name, 'push')
andsteps.check-branch.outputs.publishable == 'true'
are true, it should return0
. However, it is returning2
as seen in the debug logs below:It is altering the conditional by moving the closing brace to surround the
0
as well so that the only possible result to return is2
. This means that this step is only fetching the latest two commits. In the case ofmod_scormremote
, fetching only the last two commits is not enough to find previous SHA37eed5f
Note that setting
fetch-depth
to0
is recommended here