commitizen-tools / commitizen-action

Commitizen github action to bump and create changelog
MIT License
77 stars 36 forks source link

Add a previous_version output, equivalent to the PREVIOUS_REVISION environment variable, or similar #93

Closed Clockwork-Muse closed 3 hours ago

Clockwork-Muse commented 15 hours ago

I'm trying to condition following steps in my workflow to only run if a bump occurred. To that end, it would be nice if there was an output available, so I could do something like the following:

- name: Run check
     if: ${{ steps.bump.outputs.version }} != ${{steps.bump.outputs.previous_version }}
        run: |
          echo "whatever"

... and/or some boolean output I could refer to afterwards (but knowing the previous version is useful generally).

I'm aware of the PREVIOUS_VERSION environment variable, however it's not available for if checks there, and autocomplete in VSCode of course complains it doesn't exist.

Clockwork-Muse commented 15 hours ago

Okay, it turns out that the environment variable is available there, the following works:

- name: Run check
     if: steps.bump.outputs.version != env.PREVIOUS_REVISION
        run: |
          echo "whatever"

(I'm still figuring out some aspects of GitHub actions and their expressions)

.... VSCode does complain pretty loudly about the reference potentially not being available, though...

woile commented 3 hours ago

I'm not sure why github reports this. I'm glad it works, feel free to open again