NickLarsenNZ / terrain

List Hashicorp Terraform resources, datasources, variables, and more to automate documentation of Infrastructure as Code
1 stars 1 forks source link

Make a local action for getting the tag from refs/heads/master #29

Open NickLarsenNZ opened 4 years ago

NickLarsenNZ commented 4 years ago

Some jobs require knowing the tag. Usually this is available through the GITHUB_REF environment variable if the workflow runs on.push.tags.

Since Github Actions cannot trigger other workflows, we are not able to have a workflow to bump the semver, then another to trigger off that.

For workflows triggered by on.push.branches: ["master"], GITHUB_REF=refs/heads/master. So we need to get the tag ourselves (eg: git rev-parse or git describe --tags). However, the checkout action does a shallow checkout.

We then end up with repeated blocks to fetch tags, like:

https://github.com/NickLarsenNZ/terrain/blob/eedb626fb8266ef81f4f27750bd565e269fa3a67/.github/workflows/merge-master.yml#L40-L49

https://github.com/NickLarsenNZ/terrain/blob/eedb626fb8266ef81f4f27750bd565e269fa3a67/.github/workflows/merge-master.yml#L51-L53

This should become an action.