-
-
Notifications
You must be signed in to change notification settings - Fork 232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Option to tag the commit as well #47
Comments
Yeah, I thought about adding a In the meantime, I think something like this should already work: - uses: stefanzweifel/[email protected]
with:
commit_message: Apply automatic changes
# Optional git params
commit_options: '&& git tag -a v1.0.0 -m "v1.0.0"' The |
I'll give that a try, thanks. |
Hello again, I've just released
Hope this works for you. |
Thanks! I'll let you know next release when I tag something about just how awesome it is. |
@stefanzweifel this works a treat. I do have question, though, and it's probably related to my not understanding something about either workflows or this action. My changes and tags are showing up on a branch, not on master. Looking at the repo, the changes are not on master, but I can see the tag in the drop-down, and if I switch there, I see the changes. If I pull the tag in a clone, git merges the tag onto master and if I then push it, the changes show up. Am I missing an option? Did adding the tag function change how git-auto-commit is working? Was git-auto-commit always committing changes to a branch? Thanks |
Happy to clarify questions. Sorry, for the wall of text.
Depending on how you've configured your Workflow, the tag is indeed only showing up on the branch. Or said in another way: The Action pushes the created tag to the same branch, to which the commits is pushed to. Here's the demo project + workflow I usually use to test this Action. (It's a PHP app, but you get the gist.) Here I'm listening to the
This sounds like a feature of GitHub. They list every tag in a repository, no matter the branch the tag has been pushed on. ↓
Without knowing your exact setup this is quite a hard question to debug. 😅 I assume your workflow listens to the
Whenever a change is detected in the pull request branch, a new commit would be created and the commit would be tagged with whatever string is passed to the Only now I've discovered, that this is probably not the smartest idea. I think this could lead to duplicate git tags (I think). It would probably be better to listen to another GitHub event. However, their documentation does not list any event which would make sense to me, for when to create a tag: https://help.github.com/en/actions/reference/events-that-trigger-workflows
Yes, the Action always just did that: Make a commit of the change and push the changes up to the remote repository. The tagging feature was only just a small addition. It doesn't have any impact on the other functionality. |
I thought about uploading the workflow. I'll attach it: name: Update tap
on:
repository_dispatch:
types: [my-release]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
- name: Update recipe
shell: bash
run: ./update.sh "${{ github.event.client_payload.tag }}"
- uses: stefanzweifel/[email protected]
with:
commit_message: Update recipe to version "${{ github.event.client_payload.tag }}"
tagging_message: ${{ github.event.client_payload.tag }}
# Optional glob pattern of files which should be added to the commit
file_pattern: gotop.rb
# Optional commit user and author settings
commit_user_name: Tap Updater
commit_user_email: [email protected]
commit_author: Tap Updater <[email protected]>
I'd read about the branch option; I am not using it, which is what confuses me. |
Thanks for the workflow file. (I've edited your comment to include the workflow directly in the comment, so it's a bit easier to read.) Your workflow is setup to listen to the I guess I guess, this is happening here too. My assumption about what you want to achieve here:
I think you could accomplish this by being explicit, which branches should be checked out. Your workflow might then look like this. name: Update tap
on:
repository_dispatch:
types: [my-release]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
+ with:
+ ref: 'master'
- name: Update recipe
shell: bash
run: ./update.sh "${{ github.event.client_payload.tag }}"
- uses: stefanzweifel/[email protected]
with:
+ branch: 'master'
commit_message: Update recipe to version "${{ github.event.client_payload.tag }}"
tagging_message: ${{ github.event.client_payload.tag }}
# Optional glob pattern of files which should be added to the commit
file_pattern: gotop.rb
# Optional commit user and author settings
commit_user_name: Tap Updater
commit_user_email: [email protected]
commit_author: Tap Updater <[email protected]>
The The Action is in it's core also just a very basic bash script. Here are the lines of code which are responsible of creating the commit and pushing it to a remote repository. |
Interesting. So, yes. In my use cases, I have:
Separating into different repos prevents too much churn and bulk in the main project. The tagging is so that I can link releases across repositories. I would actually think that tagging a branch would be a great thing, except some channels (like NixOS) expect tags to be on the master branch and get discombobulated if you step outside of that. And I don't have control over those channels. I'll give your suggestion a try -- I'm sure it'll work just fine, thank you. |
Sounds like a great idea to automate the entire release process. 👍 I personally always create a tag on |
Describe the solution you'd like
An optional
tag:
key with which to tag the commit.Additional context
This would be useful when the action is being used on an ancillary repository to synchronize workflows.
In my case, I have a project that, when published, triggers a number of other project workflows to start; these helper workflows do things like update Homebrew recipes and build Arch AUR packages. I'm using git-auto-commit-action to commit the changes being made by the workflows; it'd be great if the repos could also be tagged with the same tag as the upstream project tag that kicked everything off; for this, I'd need git-auto-commit-action to also tag the commit.
The text was updated successfully, but these errors were encountered: