[Question] Problem with create tag
solairen opened this issue · 2 comments
solairen commented
Hi, I have a problem with tagging to create a release. If I use ${{ github.ref }}
the action will create the tag with the name:
refs/heads/main
. It is possible to set the proper variable to create the tag like 1.0
or v1.0
?
How to reproduce:
- Create action with
actions/create-release@1
- In
tag_name
set${{ github.ref }}
- Run action
Additional info
My workflow:
Create_Release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.token }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: |
Changes in this Release
- some changes
draft: false
prerelease: false
The release looks like this:
Release refs/heads/main
@solairen solairen released this 6 minutes ago
Changes in this Release
victorbnl commented
I have two solutions: you can use github.sha
to use the commit's sha, or github.run_number
, it's a number that start at 1 for the first workflow run and increments each runs
EDIT: I think it's better to use github.run_number
in case you, for whatever reason, run two times the workflow on the same commit
solairen commented
@Victor-Bo Thanks!