changed: either "true" or "false", indicates whether the version has changed.
version: if the version has changed, it shows the version number (e.g. "1.0.2")
commit: if the version has changed, it shows the sha of the commit where the change has been found.
To access these outputs, you need to access the context of the step you previously set up: you can find more info about steps contexts here.
If you set your step id to check you'll find the outputs at steps.check.outputs.OUTPUT_NAME: you can use these outputs as conditions for other steps.
Here's an example:
- name: Publish if version has been updated
id: check
uses: pascalgn/npm-publish-action@f6302932be3d13d292168d31a9ea193c717567ff
# This is tagged version v1.3.7, but do not use version tags
# https://julienrenaux.fr/2019/12/20/github-actions-security-risk/
- name: Log when changed
if: steps.check.outputs.changed == 'true'
run: 'echo "Version change found in commit ${{ steps.check.outputs.commit }}! New version: ${{ steps.check.outputs.version }}"'
- name: Log when unchanged
if: steps.check.outputs.changed == 'false'
run: 'echo "No version change :/"'
PR for #20 issue
Add outputs context like version-check repo.
Outputs
changed
: either "true" or "false", indicates whether the version has changed.version
: if the version has changed, it shows the version number (e.g. "1.0.2")commit
: if the version has changed, it shows the sha of the commit where the change has been found.To access these outputs, you need to access the context of the step you previously set up: you can find more info about steps contexts here.
If you set your step id to
check
you'll find the outputs atsteps.check.outputs.OUTPUT_NAME
: you can use these outputs as conditions for other steps.Here's an example: