I have a github action that is triggered when a release is created.
The goal is to:
So far, I have this:
CURRENT_TAG=${{ github.event.release.tag_name }}
PENULTIMATE_TAG=$(git describe --exact-match --tags `git rev-list --tags --max-count=1 --skip=1`)
These are then echoed out for testing. The first works correctly, but the second always returns empty. I have tried the exact same command locally, and it returns the second most recent tag, as expected.
I have no idea why it wouldn't work in a github action. For the sake of debugging, I removed the git describe component, confirming that it is in fact git rev-list that is returning nothing.
Need to fetch all history by passing the fetch-depth option:
- uses: actions/checkout@v2
with:
fetch-depth: 0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With