Same shell script produces different results when called from GitHub actions vs Bitbucket workflow

Viewed 264

I've noticed that GitHub action does not fail as expected. The same shell script is used in bitbucket pipeline and it fails there as expected. The script is https://github.com/pavelfomin/gphoto-manager/blob/master/scripts/check-release.sh. It returns 1 if the version in the pom.xml exists as a tag already.

I've tested the script locally and it does return 1 when tag already exists.

GitHub action: https://github.com/pavelfomin/gphoto-manager/actions/runs/570220185 https://github.com/pavelfomin/gphoto-manager/blob/master/.github/workflows/maven.yml

BitBucket pipeline: https://bitbucket.org/pvlf/gphoto-manager/addon/pipelines/home#!/results/2 https://github.com/pavelfomin/gphoto-manager/blob/master/bitbucket-pipelines.yml

What am I missing?

1 Answers

The issue is caused by actions/checkout@v2 fetching the git repository with --depth=1 and without fetching the tags by default. The solution is to specify fetch-depth: "0"

    - uses: actions/checkout@v2
      with:
        # 0 indicates all history for all branches and tags
        fetch-depth: "0"
Related