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
Accept GITHUB_TOKEN for authentication #16
Comments
A username with a token also works totally fine, that's how I'm using it because of 2fa. |
@bradrydzewski one thought I've had, and you know of this but I'll write it out here, is that if we treat the drone scm connection as a server that can be hit during a build. The token could then be injected into the build step and used. This particular plugin could be a case of that. It could also work for something like a status update so that could be a plugin. |
@tboerger Maybe I'm misunderstanding something, but it sounds like i can use a deploy key in place of a password. I'm trying to do so like this:
I've added the secret to the drone project, and i've enabled write access on the deploy key. For some reason I'm hitting this:
Any thoughts on why that might be? |
I have never used this particular plugin, but I can say that when using a token for git operations you need to use the token as the username, and - name: publish
image: plugins/gh-pages
settings:
- username: counterbeing
- password:
- from_secret: github_deploy_key
+ username:
+ from_secret: github_deploy_key
+ password: x-oauth-basic
pages_directory: rendered_assets |
Thanks @bradrydzewski for the quick response! That still failed with the same error though. |
I would also point out that, I believe, deployment keys can only be used to clone code. They cannot be used to push code, which is required of this plugin. Perhaps try using a personal token instead? EDIT looks like deploy keys can be used to push code if you check the "write access" checkbox. If you have already enabled write access, the next step to debug would be to run the plugin locally and test out your configuration, examining the source if necessary. For instructions to run locally see https://github.com/drone-plugins/drone-gh-pages#usage |
When adding a key there is a checkbox to enable pushing. I was sure to check it. I think it may be that the repo is cloned via https, but needs to be uploaded via ssh to use the key. I may need to set the url to use ssh. If i figure it out i'll post again. Edit: you beat me to it. |
ah yes, the username and password fields are for username/password/api tokens, not ssh keys. So that explains why this was not working. If you want to use the plugin with an ssh key it should look something like this:
In terms of using the ssh clone address, there is a |
@bradrydzewski this is not working for me. Tried:
and:
and:
Tried adding the SSH key in repository and profile. In all cases:
I think the problem is that the remote url doesn't get modified. |
@bradrydzewski |
If you want to use the token, all I did was set it as the value for my password secret and it work flawlessly. Create a Github personal token, populated your environment variable where the gh_password=TOKEN then all I did was have something along these lines in my config. - name: publish
image: plugins/gh-pages
settings:
username:
from_secret: gh_username
password:
from_secret: gh_password |
I just wanted to document an idea for a feature. We could add a
GITHUB_TOKEN
secret which will automatically use the token as the username, and set the password tox-oauth-basic
.This is possible today, however, I get the sense that most people don't realize it is an option. Providing some nice syntactic sugar to the existing username and password parameters could make this capability more accessible, since I think a token is always preferable to a username and password.
The text was updated successfully, but these errors were encountered: