I’m doing a github action for a project that has this part:
- name: Check for version change
id: check_version
run: |
git fetch origin main
VERSION_CHANGED=$(git diff --name-only ${{ github.event.before }}..HEAD | grep -c '^src/manifest.json$')
echo "version_changed=$VERSION_CHANGED" >> "$GITHUB_OUTPUT"
It allows me to see if there has been a change in my manifest file. It returns 1 if yes and 0 if no.
The problem is that when it returns 1, all the rest of my action goes smoothly, but on the other hand, it exit me with this error:
Run git fetch origin main
git fetch origin main
VERSION_CHANGED=$(git diff --name-only 32f9a1bbdaa01bcda6cbc59973fe89707c92abc2..HEAD | grep -c '^src/manifest.json$')
echo "version_changed=$VERSION_CHANGED" >> "$GITHUB_OUTPUT"
shell: /usr/bin/bash -e {0}
* branch main -> FETCH_HEAD
Error: Process completed with exit code 1.
And this is the result when everything goes well, even if I doubt it’ll do any good:
Run git fetch origin main
git fetch origin main
VERSION_CHANGED=$(git diff --name-only c47cdb4394c93c367b97241d7618a7608e9acb64..HEAD | grep -c '^src/manifest.json$')
echo "version_changed=$VERSION_CHANGED" >> "$GITHUB_OUTPUT"
shell: /usr/bin/bash -e {0}
* branch main -> FETCH_HEAD