action-gh-release icon indicating copy to clipboard operation
action-gh-release copied to clipboard

Can't seem to meet tag requirement

Open miketrethewey opened this issue 5 years ago • 4 comments

I'm using a local copy of your action for reasons, however, I can't seem to get the script to be happy with a tag that I'm setting. The Workflow fires on:push and on:pull_request. I want to create a tag during the workflow sequence based on some environment variables. I can't seem to set the tag (git tag ${GITHUB_TAG}) in a proper location within the workflow so that your script can pick it up. I see that some commands require a push of the tag, but that would likely result in an infinite loop of workflow runs, which would be bad. I hope you can point me at the obvious thing that I'm not seeing.

miketrethewey avatar Sep 13 '19 02:09 miketrethewey

@miketrethewey thanks for reaching out.

Can you link to a repo where I can see and possibly try to reproduce your example?

I typically don't create a tag inside a workflow run but I think that should be possible. I can add some examples to the readme file. The logic that creates a tag on a push would need to be conditional in someway, I think you hinted at an env variable, in order to not create a loop but I don't think it's common to create a tag on every push.

That doesn't sound that the kind of problem that would be specific to this action. A push trigger that generates a push trigger that generates a push trigger sounds like a more general problem :) perhaps the workflow action that pushes a tag could only tag on pushes the specific branches when the current push ref is not a tag itself.

If you could link me to an example I can provide some more concrete help.

softprops avatar Sep 13 '19 02:09 softprops

actions-test branch of Artheau/SpriteSomething

miketrethewey avatar Sep 13 '19 03:09 miketrethewey

Few things I noticed on initial glance.

  1. I don't think env variables get passed to between workflow actions steps by default. This may break some assumings the following code assumes

https://github.com/Artheau/SpriteSomething/blob/d514706adacc2ddebaa2c4e3c44a11a0791c930c/.github/workflows/ci.yml#L208

I haven't tied this myself yet but I'll do some experimenting. There does seem to be a special syntax for doing this mentioned in the docs

  1. git tag only creates a tag on the runner. You need to push it to your git remote for GitHub releases to resolve it. https://github.com/Artheau/SpriteSomething/blob/d514706adacc2ddebaa2c4e3c44a11a0791c930c/.github/workflows/ci.yml#L211 I'll try an put together an example in this action's readme showing how to do that

  2. there can be only one body. https://github.com/Artheau/SpriteSomething/blob/d514706adacc2ddebaa2c4e3c44a11a0791c930c/.github/workflows/ci.yml#L225 uses both options but only one will be used. This is mentioned here

I can take a closer look this weekend

softprops avatar Sep 13 '19 11:09 softprops

  1. Yeah. I’ve been attempting to just write and read them from disk, or do the same action twice, which is obviously redundant.

  2. I think I’m being tripped up by whatever “push” means as an event that the system checks for. What I really want is for it to fire on “commit” and “pull request.”

  3. Yep. I’m hoping that it’ll cat the contents of RELEASENOTES.md and if that fails, it’ll just provide a hyperlink to it instead.

Thanks for the insight! That’ll give me a direction when I too return home from work today.

miketrethewey avatar Sep 13 '19 15:09 miketrethewey