Skip to content
This repository has been archived by the owner on Mar 4, 2021. It is now read-only.

README instructs users to do strange things to their repositories. #116

Open
emctague opened this issue Jan 9, 2021 · 4 comments
Open

Comments

@emctague
Copy link

emctague commented Jan 9, 2021

The example use of create-release in the README contains this line:

          tag_name: ${{ github.ref }}

Should a user leave this in while having actions set to trigger for their master/main branch, this will result in a new tag being created called refs/heads/main... This means:

  1. The tag will be the same every time the action tries to create a release

  2. After this action is triggered, trying to simply push to the repository (e.g. git push or git push origin master) will not work. Users will probably try to delete the tag... Examples for "delete a tag" found across the internet look like git push origin :refs/tags/main. The proper way to delete this tag is git push origin :refs/tags/refs/heads/main, but users will probably mistakenly run other commands such as git push --delete origin :refs/heads/main due to the confusing name of this tag, deleting their remote main branch.

I suggest changing the tag_name line in the README's example use to something along the lines of tag_name: release-${{ github.sha }} to ensure the example works out-of-the-box without any unusual issues.

@fraciril
Copy link

Another tag name that worked for me is tag_name: ${{ github.run_number }}, which I found friendlier than the sha:

run_number: stringA unique number for each run of a particular workflow in a repository. This number begins at 1 for the workflow's first run, and increments with each new run. This number does not change if you re-run the workflow run.

@Oskar619
Copy link

Came here just for this, I messed up my master branch in my repository because I was trying to test the example.
At least some comments stating why you shouldn't do it with a non-tagged branch could have helped me avoid this situation.

@ash0x0
Copy link

ash0x0 commented Feb 27, 2021

There was probably an implicit assumption by whoever wrote the README that people would be using this conditionally with version tags so I think there were assuming the step/job would have if: startsWith(github.ref, 'refs/tags/v') which is probably what anyone using some release action like this should have.

@emctague
Copy link
Author

@ash0x0 for best practice use I would agree but in some simple projects (such as the one that prompted me to make this issue) it can be useful to just build any commit and create an artifact for it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants