-
-
Notifications
You must be signed in to change notification settings - Fork 22
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
Can’t figure why tags action does not fire #175
Comments
In perftools/xhgui#431, the workflow is not designed to act on tags, only on milestone closed 🤔 |
@Ocramius but workflows/release-on-milestone-closed.yml creates git tag, pushes it. how to make github to invoke "on: tags" workflows? or you have some other ideas on how to make docker image when a release is made? perhaps document it? |
Wait, so https://github.com/perftools/xhgui/blob/de576f400c6c2fff0568c468da7357debccbb353/.github/workflows/docker.yml#L13 is not triggered when the tag is created by |
But I changed to use org token (noted in bug report body): |
And if you check the tag, it's created by user, rather github-actions: |
Don't really know why it didn't trigger anything: I suggest creating a fork and trying out stuff there, with new tags 🤔 |
@glensc hey,
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
create:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
# Runs a command
- name: Run a build
"GIT_AUTHOR_NAME": ${{ secrets.GIT_AUTHOR_NAME }}
"GIT_AUTHOR_EMAIL": ${{ secrets.GIT_AUTHOR_EMAIL }}
hope that helps. |
@ghostwriter are you saying io should switch from "on: push" to "on: create"? I've read the documentation and don't understand why one is better than the other:
also, your example is confusing, it says things that are not described there (what main branch?, why I need to filter tags with "if"). can you point to the origin of that workflow, as I think you redacted it too much and I can inspect runs of such workflow. also, changing GIT_AUTHOR_EMAIL and GIT_AUTHOR_EMAIL does not change origin of the tag push events, it only changes metadata. the tag will be still be created with ORGANIZATION_ADMIN_TOKEN and from UI it's already visible, the tags are not created with GITHUB_TOKEN=github-actions, but user token (look at the screenshot): also: can you be distinct, that you know how to fix, or you guess how to fix? |
Ok, after some testing, I've come to the conclusion that "on: push" and "on: create" difference is that "on: create" is fired only once. so it's suitable for tags run (tags are created once), but not suitable for branches. NOTE: this is not a solution to the problem, just an observation about the "on: create" event. |
I've changed GIT_AUTHOR_NAME/GIT_AUTHOR_EMAIL: But it has no effect, the tag is still authored with my personal credentials: The tag author comes from where? gpg key?
so what for the GIT_AUTHOR_NAME/GIT_AUTHOR_EMAIL are used if not tag creation? |
@Ocramius can you add some debug mode to this workflow so could pin down what is happening based on commands executed and their environment? if there's any debug mode, it's not documented in README.md |
I think adding |
we use My example workflow regarding This ( https://github.com/perftools/xhgui/releases/tag/0.19.0 ) is not the "tag". This is the "Github Release Notes", it contains the contents of the |
@ghostwriter so my guess was right, the email/name comes from gpg key, not GIT_AUTHOR_NAME/GIT_AUTHOR_EMAIL, and the documentation is incorrect? |
@glensc I'm not sure. I believe that may be the case, but only if
automatic-releases/src/Git/FetchAndSetCurrentUserByReplacingCurrentOriginRemote.php Lines 31 to 32 in 41da249
|
@ghostwriter in the last tag created by this workflow, the env variables are not used, because my local test proves otherwise:
so. why things don't work for me with this workflow? |
|
@glensc you don't have an actual bot account (Github User), so when you supply a Which is might be why all of the published/released tags are attributed to your account. |
@ghostwriter this is pretty messy considering multiple topics at hand.
please pay attention that token doesn't matter absolutely at all when git command is used to create tag. and the code you linked used git command not github api to create git tag. so, I counter claim: git tag is created with ORGANIZATION_ADMIN_TOKEN and "on: push" still doesn't fire. also worth understanding that technically git tag is created with git command (as you pointed to source), but tag is pushed with token. probably https protocol auth uses the same token. so without debugging in code, it's impossible to tell externally what token was used to push the changes. or knowing the code. but I'm assuming git push is used over https URL to publish git tag. |
@ghostwriter also you need to understand that GIT_AUTHOR_NAME/GIT_AUTHOR_EMAIL can be anything - these do not point to any account (bot or not). the git show I used, is metadata stored in git repository. see my example again. there is no github involved in that example. only git. |
Related to verbosity, please check #76 |
https://stackoverflow.com/a/18512221 eg.
you are correct, "git command is used to create tag". when i said:
I was talking about the "Github Release", which requires an authenticated user. automatic-releases/src/Github/Api/V3/CreateReleaseThroughApiCall.php Lines 44 to 51 in 41da249
|
My understanding is:
AutoRelease:
|
Shell\execute('git', ['config', 'user.email', $this->variables->gitAuthorEmail()], $repositoryRootDirectory); | |
Shell\execute('git', ['config', 'user.name', $this->variables->gitAuthorName()], $repositoryRootDirectory); |
we can add:
user.signingkey
and commit.gpgsign
// FetchAndSetCurrentUserByReplacingCurrentOriginRemote.php
Shell\execute('git', ['config', 'user.signingkey', $this->variables->signingkey()], $repositoryRootDirectory);
Shell\execute('git', ['config', 'commit.gpgsign', 'true'], $repositoryRootDirectory);
remove '--local-user=' . $keyId->id()
Shell\execute('git', ['tag', $tagName, '-F', $tagFileName, '--cleanup=whitespace', '--local-user=' . $keyId->id()], $repositoryDirectory); |
AutoRelease: GitHub release
author is ambiguous. (token)
You have to provide an ORGANIZATION_ADMIN_TOKEN (with a full repo scope), which is a GitHub token with administrative rights over your organization (or regular user project, for non-organization projects), issued by a user that has administrative rights over your project (that's you, if it is your own non-organization repository).
The ORGANIZATION_ADMIN_TOKEN
and or GITHUB_TOKEN
you provide is associated to the user that created it.
This token is used to authenticate and attribute GitHub related actions.
- CRUD Branches
- CRUD Issues
- CRUD Milestones
- CRUD & Merge PRs
- CRUD Releases
If you have plans to use a Bot, to attribute GitHub related actions (eg. Release "bot-user released 0.1.0"), you should create a dedicated GitHub user account for the bot.
DockerBuild: not triggered via git tag
event.
- I recommend using the
on: create
event for this.
on:
# run on all PRs
pull_request:
# run on push if branch name match pattern
push:
branches:
- "*.*.x"
tags:
- "*.*.*"
# run on create if branch or tag name match pattern
create:
branches:
- "*.*.x"
tags:
- "*.*.*"
- we can try
git push --follow-tags origin {tag}
here.automatic-releases/src/Git/PushViaConsole.php
Lines 25 to 27 in 41da249
Shell\execute('git', ['branch', $localTemporaryBranch, $symbol], $repositoryDirectory); Shell\execute('git', ['push', 'origin', $localTemporaryBranch . ':' . $alias], $repositoryDirectory); Shell\execute('git', ['branch', '-D', $localTemporaryBranch], $repositoryDirectory);
Also https://github.com/actions/checkout mentions.
|
I asked you, have you tested this, or you are just guessing this will work? did not notice you replied. can you answer now? and why would "on: create" work and "on: push" will not? do you have workflow where this works? ps: I know what is git tag, git lightweight tag, git annotated tag and git signed tag and github releases. i was just pointing to the tag so you can see of what git object I was talking of. and what is the GIT_AUTHOR_EMAIL stored on the object. github UI no longer allows to link to just tag if release also exists. |
I wanted to change GIT_AUTHOR_NAME and GIT_AUTHOR_EMAIL that are attached to the git tag. Currently, the env variables in CI do not have the intended effect. |
Yes, It works. I'm using it just fine. You will find a few repos that use this method linked to this issue, including the example workflow i shared earlier. actions/runner#1007
Great! we're on the same page.
Correct. |
The difference between push
create
Note:
|
Okay. the docker build on tag creation is now fired after this PR: but merge-up test jobs are still not fired: example: |
Hey @glensc, Reason: "This branch is out-of-date with the base branch" If I'm not mistaken, your current default branch 0.21.x has a "Require status checks to pass before merging" and "Require branches to be up to date before merging" enabled with an invalid branch protection rule. It expects 3 workflows with the name "PHP 7.2", "PHP 7.3", and "PHP 7.4" to run, but they are not in your repo. Please remove the invalid/outdated status check in the protected branch setting of the repository settings. For example: I had set the two checks "Build" and "Trigger Azure pipeline run" as " Required". But the job "Trigger Azure pipeline run" was not actually executed because I had removed/renamed it from the workflow, it stuck here. So I go to update the branch rules to disable "Trigger Azure pipeline run". Then reopen/refresh the page of the PR, all checks were passed, and I can merge the PR. Hope that helps. |
this incorrect. the same workflow works fine if I am the one initiating the push: and this is what workflows autocomplete shows if I try to change: I've removed "Require branches to be up to date before merging". but I'm pretty sure that is not the reason why those jobs were not executed. why two other jobs were executed? Publish Docker image for example. Does not make sense. But changing the state won't re-run the actions. so I disabled actions at all, and re-enabled. now both can be merged but the tests were not run at all, like they don't exist. |
Yes, it does make sense. The tests are triggered by the Workflows will not run on the Conversely, workflows with the --
closing and reopening the PR should re-trigger the event. By default, a workflow only runs when a |
The merge up CI seems to have passed now: There were no changes to CI config in git repo, but project settings was changed to remove "require branch to be up to date" So this could not have been the reason of it being broken before:
|
Since both problems were solved:
I'm going to close now. Thanks for the support. |
Bug Report
I’ve set up the integration to build docker images:
I’ve read the readme, that needs to use org token:
but still, the events for git push don’t fire:
it should build on pushed tags
*.*.*
, for example,0.19.0
:This is re-post of the forum post, since seems this project maintainers do not follow forums:
The text was updated successfully, but these errors were encountered: