Manually Authorizing Bloom to Generate Github Pull Requests
Contents
If you have two-factor authentication enabled for github, bloom cannot log in with your github password alone. There are two steps:
- Create a personal access token on github and tell bloom about it. This is used for pull-request opening.
- Re-route https traffic through ssh (assuming you have public-key authentication enabled). (This will only enable git push and pull, but not pull-request opening)
Token-based authentication
Create an access token
Go to the github website and login. Open the settings page, go to Developer Settings and click on Personal access tokens in the menu on the left (As of 2022/02, the following instruction is for "Classic" token whereas GitHub may suggest their new "Beta" token system).
Click the "Generate new token" button, and follow the instructions. Make sure that the "public_repo" authorization is granted under the repo subtree and the "workflow" authorization is granted. Set the description to something like "Bloom token". After you have created the token, you will end up back at the "Personal access tokens" page. The new token will be highlighted in green. Copy the alphanumeric token to the clipboard.
Configure bloom to use the token
Open ~/.config/bloom in a text editor. If it doesn't exist, create it. Enter the following text into the file:
{ "github_user": "<your-github-username>", "oauth_token": "<token-you-created-for-bloom>" }
Filling in your username and the token you made in the previous step. Save the file. From now on, bloom should be able to automatically create pull requests to rosdistro for you when you do releases.
You may still see request for username/password from Bloom when releasing. If so, the next step is to redirect the https requests to use your ssh authentication for the repository pull and push:
Re-route https through ssh
As suggested here, you can also re-route bloom's https traffic through ssh by editing your .gitconfig file:
# Always use ssh for github, even if the remote URL uses https or git [url "git@github.com:"] insteadOf = git://github.com/ [url "git@github.com:"] insteadOf = https://github.com/
NOTE that if you choose this option, be sure not to forget enable ssh connection with `github`.
Bash Script for setting up OAuth Token
In case you use automatic setup scripts for your computer, you might find this script helpful:
# Install Bloom Github oauth access token for releasing ROS packages function installros_github_token() { read -p "Your Github username: " userName read -p "A Github oauth token for your account: " oAuthToken rm -f $HOME/.config/bloom cat <<EOF >> $HOME/.config/bloom { "github_user": "$userName", "oauth_token": "$oAuthToken" } EOF }