You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@relekang also I had temporarily fixed this in my CI by appending .git to the origin but had some other issues that prevented me from using the package e.g. --noop still pushing tags etc. I will create issues as I don't think those are github actions specific.
I'm testing the merged version and using GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} which uses the default GITHUB_TOKEN. This results in the following error while trying to push:
stderr: 'fatal: could not read Password for 'https://[AUTH_TOKEN]@github.com': No such device or address'
I believe the problem is the default GITHUB_TOKEN expects to be used with a GITHUB_ACTOR as the username. I'm basing this observation on this code.
I'll play around and see if it's as simple as adding GITHUB_ACTOR as the user in the https string.
I ended up getting farther with my repo changes. However, ran into a branch protection issue.
stderr: 'remote: error: GH006: Protected branch update failed for refs/heads/master.
remote: error: You're not authorized to push to this branch. Visit https://help.github.com/articles/about-protected-branches/ for more information.
I wasn't sure if the problem was because I'm committing to an organization, so I gave up with the GITHUB_TOKEN(I'm an admin on the repo I'm pushing to so not sure why the GITHUB_TOKEN isn't enough to log in as my account and didn't want to debug it further) and created a personal access token. With that I was able to commit using my changes.
However, I don't know if my changes are necessary with a personal access token so I'm leaving this comment in case someone wants to try the code with a GITHUB_TOKEN. If it works, happy to do a PR or you can just integrate my code directly.
With the new GITHUB_ACTOR checks, I have been able to create a working GitHub Action here, if anyone is interested in taking a look. I haven't tested it with every possible configuration.
One problem I'm having is that the release notes are replaced with a short message containing only the name of the tag, as seen here. I'm not quite sure what is causing this, but it only happens when running from GitHub Actions.
It is not replaced, that tag is missing release notes so it is showing the annotated message from the git tag. If you view the list of tags in github it shows which have release notes and which does not. My guess is that the upload of changelog failed.
@KingDarBoja I see, I'm thinking the easiest way to do this is to pass a subdirectory as an input and cd into it as part of the entrypoint script. Then to run for multiple projects you can just repeat the step with a different directory.
I'll implement that quickly and push it to a branch for you to try.
@AlphaMycelium Hi mate, just tested it and now it was able to cd to the correct dir, however, now I am facing some error that I think isn't related to the actions but semantic release:
Current version: 1.0.0Fri, 14 Feb 2020 14:35:58 GMT semantic_release:cli 'main args:' {'force_level': None, 'post': False, 'retry': False, 'noop': False, 'define': ()} +0.0usFri, 14 Feb 2020 14:35:58 GMT semantic_release:cli 'main env:' 'PYPI_USERNAME="",PYPI_PASSWORD="",GH_TOKEN="$GH_TOKEN",GL_TOKEN="None",' +68.75usFri, 14 Feb 2020 14:35:58 GMT semantic_release:cli 'main config:' {'check_build_status': 'false', 'commit_message': 'Automatically generated by python-semantic-release', 'commit_parser': 'semantic_release.history.angular_parser', 'patch_without_tag': 'false', 'upload_to_pypi': 'false', 'version_source': 'commit'} +84.5usFri, 14 Feb 2020 14:35:58 GMT semantic_release:history 'get_current_version_by_config_file' +0.0usFri, 14 Feb 2020 14:35:58 GMT semantic_release:history 'lib/__init__.py' '__version__' +24.0usFri, 14 Feb 2020 14:35:58 GMT semantic_release:history <re.Match object; span=(0, 21), match='__version__ = "1.0.0"'> +283.25usFri, 14 Feb 2020 14:35:58 GMT semantic_release:cli 'publish: retry=' False +669.75usFri, 14 Feb 2020 14:35:58 GMT semantic_release:history:logs 'evaluate_version_bump("1.0.0", "None")' +0.0usFri, 14 Feb 2020 14:35:58 GMT semantic_release:vcs_helpers 'Reference v1.0.0 does not exist, considering all log' +0.0usFri, 14 Feb 2020 14:35:58 GMT semantic_release:history:logs 'ignored' UnknownCommitMessageStyleError('Unable to parse the given commit message: Provide new directory option to actions\n') +9.4msFri, 14 Feb 2020 14:35:58 GMT semantic_release:history 'get_new_version("1.0.0", "None")' +9.7msFri, 14 Feb 2020 14:35:58 GMT semantic_release:vcs_helpers 'get_repository_owner_and_name' <re.Match object; span=(18, 55), match='/somerepo/my-project-name'> +10.1msFri, 14 Feb 2020 14:35:58 GMT semantic_release:cli 'branch=' 'master' +10.6msCmd('git') failed due to: exit code(1) cmdline: git checkout master stderr: 'error: pathspec 'master' did not match any file(s) known to git'##[error]Docker run failed with exit code 1
Not sure why it is trying to checkout master branch if I am trying to set it on some experimental branch.
Nevermind, was missing the branch option at my setup.cfg. Now the version failed to publish but
I assume it is due to the commit message not following the convention, right?
@KingDarBoja I'm using setuptools-scm to get the version from Git tags instead of explicitly defining it in setup.py and __init__.py. This is to avoid having a commit created every time a new release is published. That's why I also set version_source=tag.
I only include version_variable in setup.cfg because semantic release was throwing errors if I didn't, as far as I know it's never actually used.
@KingDarBoja It looks like it's trying to find commits which occur after the v1.0.0 tag, but that doesn't exist, so it looks at the entire commit history instead.
One problem I'm having is that the release notes are replaced with a short message containing only the name of the tag, as seen here.
Since KingDarBoja's release notes are working, I think the problem I'm having with them is something specific to my own setup and not caused by GitHub Actions.
@KingDarBoja For reference, are you using the preset GITHUB_TOKEN secret as shown in my example configuration, or a separate personal access token?
@KingDarBoja Hmmm. I was just wondering if it was some sort of permissions thing with the automatically-generated token, but it can't be if you're using that too and it works.
This is now finished and implemented within the main repository (instead of the separate psr-action), see the documentation page for details on setting it up.
Reacted by Rolf Erik Lekang, KingDarBoja and Emmanuel Ogbizi
Activity
iamogbz commentedon Sep 13, 2019
Attempted to use this package with github actions and
publishfails with no visible error message! 😞After much head scratching I was able to identify that it errors at the
get_repository_owner_and_namestep.https://github.com/relekang/python-semantic-release/blob/24336d43f6e69ef1216d56b47892ee864af09c7d/semantic_release/vcs_helpers.py#L87-L90
Apparently github ci uses
https://github.com/iamogbz/nvshimwithout the.gitsuffix as the repo url which does not match the regex specified above!Suggested change would be
Can create an issue and open to submitting a PR
relekang commentedon Sep 14, 2019
It would be awesome if you have the time to create a PR for it 😄
iamogbz commentedon Sep 16, 2019
@relekang also I had temporarily fixed this in my CI by appending
.gitto the origin but had some other issues that prevented me from using the package e.g.--noopstill pushing tags etc. I will create issues as I don't think those are github actions specific.ci: install specific version of semantic-release
alandtse commentedon Sep 29, 2019
I'm testing the merged version and using
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}which uses the default GITHUB_TOKEN. This results in the following error while trying to push:I believe the problem is the default
GITHUB_TOKENexpects to be used with aGITHUB_ACTORas the username. I'm basing this observation on this code.I'll play around and see if it's as simple as adding
GITHUB_ACTORas the user in the https string.alandtse commentedon Sep 29, 2019
I ended up getting farther with my repo changes. However, ran into a branch protection issue.
I wasn't sure if the problem was because I'm committing to an organization, so I gave up with the
GITHUB_TOKEN(I'm an admin on the repo I'm pushing to so not sure why theGITHUB_TOKENisn't enough to log in as my account and didn't want to debug it further) and created a personal access token. With that I was able to commit using my changes.However, I don't know if my changes are necessary with a personal access token so I'm leaving this comment in case someone wants to try the code with a
GITHUB_TOKEN. If it works, happy to do a PR or you can just integrate my code directly.danth commentedon Jan 16, 2020
@alandtse I've tried your changes with a
GITHUB_TOKEN, and can confirm that it works correctly.alandtse commentedon Jan 16, 2020
@AlphaMycelium Great, I'll put in a PR.
danth commentedon Jan 17, 2020
With the new
GITHUB_ACTORchecks, I have been able to create a working GitHub Action here, if anyone is interested in taking a look. I haven't tested it with every possible configuration.danth commentedon Jan 25, 2020
One problem I'm having is that the release notes are replaced with a short message containing only the name of the tag, as seen here. I'm not quite sure what is causing this, but it only happens when running from GitHub Actions.
https://github.com/AlphaMycelium/psr-action/issues/1
relekang commentedon Jan 25, 2020
It is not replaced, that tag is missing release notes so it is showing the annotated message from the git tag. If you view the list of tags in github it shows which have release notes and which does not. My guess is that the upload of changelog failed.
7 remaining items
danth commentedon Feb 12, 2020
@KingDarBoja I see, I'm thinking the easiest way to do this is to pass a subdirectory as an input and
cdinto it as part of the entrypoint script. Then to run for multiple projects you can just repeat the step with a different directory.I'll implement that quickly and push it to a branch for you to try.
danth commentedon Feb 12, 2020
@KingDarBoja Ok, it's on a branch called
monorepo. Give that a try and see if it works, if so I'll add some docs and release it to the marketplace.KingDarBoja commentedon Feb 14, 2020
@AlphaMycelium Hi mate, just tested it and now it was able to cd to the correct dir, however, now I am facing some error that I think isn't related to the actions but semantic release:
Not sure why it is trying to checkout master branch if I am trying to set it on some experimental branch.Nevermind, was missing the
branchoption at mysetup.cfg. Now the version failed to publish butI assume it is due to the commit message not following the convention, right?
danth commentedon Feb 14, 2020
@KingDarBoja Yeah, if the commit message doesn't follow the convention then no new version will be published.
Since I've merged the changes into
masternow, you'll need to update the action's branch in your workflow file for it to continue working.KingDarBoja commentedon Feb 14, 2020
@AlphaMycelium Makes sense, I just tried it again and the
UnknownCommitMessageStyleErrorgot away but still no new version being published.At some point, the debug log shows something like:
Reference v1.0.0 does not exist, considering all log🤔
OFF-TOPIC
I saw at your example, you provide something like this at you
setup.cfg:But the
__version__isn't there, that's on purpose? What about thesetup.pyfile without specifying theversion=versionvalue?danth commentedon Feb 14, 2020
@KingDarBoja I'm using setuptools-scm to get the version from Git tags instead of explicitly defining it in
setup.pyand__init__.py. This is to avoid having a commit created every time a new release is published. That's why I also setversion_source=tag.I only includeversion_variableinsetup.cfgbecause semantic release was throwing errors if I didn't, as far as I know it's never actually used.KingDarBoja commentedon Feb 14, 2020
Looks like the error is coming from
get_commit_log()function at vsc_helperts but not sure why!Thinking on opening a new issue for this case.
danth commentedon Feb 14, 2020
@KingDarBoja It looks like it's trying to find commits which occur after the
v1.0.0tag, but that doesn't exist, so it looks at the entire commit history instead.KingDarBoja commentedon Feb 14, 2020
I am using the
version_sourceascommitinstead oftagand setcommit_version_number=true. Maybe it is the reason it doesn't work? 🤔EDIT After looking at the source code, it works!
The key was indeed the commit history, as the source code defines the bump levels as the following:
So just pushed a single commit with the key
fixto trigger the bump level to 1.Thank you!
danth commentedon Feb 14, 2020
Since KingDarBoja's release notes are working, I think the problem I'm having with them is something specific to my own setup and not caused by GitHub Actions.
@KingDarBoja For reference, are you using the preset
GITHUB_TOKENsecret as shown in my example configuration, or a separate personal access token?KingDarBoja commentedon Feb 14, 2020
@AlphaMycelium I use the same preset as the example. Maybe the behaviour doesn't work at all if you set
version_source=taginstead ofcommit.I can't share too much about the project but below are the
actions.ymlfile and mysetup.cfg:custom-action.yml
config.cfg
I don't use
setuptools-scmif that helps.danth commentedon Feb 14, 2020
@KingDarBoja Hmmm. I was just wondering if it was some sort of permissions thing with the automatically-generated token, but it can't be if you're using that too and it works.
ci: set up releasing with GitHub Actions
danth commentedon Apr 13, 2020
This is now finished and implemented within the main repository (instead of the separate
psr-action), see the documentation page for details on setting it up.