Skip to main content

Automatically get and set GitHub & GitLab personal access tokens/ssh deploy keys

Horrible boiler plate to automate 2 tasks in GitHub, and 1 in GitLab:

  1. Set an ssh deploy key in your GitHub account, such that you can push the GitLab build status icons to a specific (hardcoded) repository in your GitHub account.
  2. Generate and get/export a GitHub personal access token, such that you can set the commit statuses of your GitHub commits. (This is used to display the GitLab CI results in your GitHub repository pull requests).
  3. Get a GitLab runner token in your own GitLab server. (I did not yet find out how to do that through docker itself using bash only).

Usage: do once

Download/clone this repository.

  1. If you don't have pip: open Anaconda prompt and browse to the directory of this readme:
cd /home/<your path to the repository folder>/
  1. To use this package, first make a new conda environment and activate (it this automatically installs everything you need).
conda env create --file environment.yml

Usage: do every time you start Anaconda

  1. Activate the conda environment you created:
conda activate get_gitlab_generation_token

Usage: do every run (Set ssh-deploy key in GitHub for pushing build status icons)

python -m gitbrowserinteract --d --ssh <the public ssh key that was created>
  • The --d indicates you are setting the deploy ssh key in GitHub.
  • The -ssh <some ssh key> is used to absorb/take in the public ssh key that you want to add to github.

Usage: do every run

Create and get GitHub personal access token for setting commit build statuses

python -m gitbrowserinteract -hubcpat
  • The --hubcpat indicates you are letting GitHub create a personal access token and storing it.

More complete:

cd $repo_name && conda deactivate && conda activate get_gitlab_generation_token \
&& python -m gitbrowserinteract --hubcpat -hu $github_username -hp $github_pwd
cd $repo_name && conda deactivate && conda activate get_gitlab_generation_token \
&& python -m gitbrowserinteract --d -hu $github_username -hp $github_pwd

Usage: do every run (Create and get GitLab runnertoken)

python -m gitbrowserinteract --g

or, to run it from bash as a pip package:

python -m gitbrowserinteract.__main__ --glr
  • The --g indicates you are letting GitLab generate a personal access token and storing it.

Testing

  1. Testing is as simple as running the following command in the root directory of this repository in Anaconda prompt:
python -m pytest

from the root directory of this project.

Updating

Build the pip package with:

pip install --upgrade pip setuptools wheel
# pip install "keyring>=23.11"
pip install twine

Install the pip package locally with:

pip install -e .

Upload the pip package to the world with:

rm -r dist
rm -r build
python3 setup.py sdist bdist_wheel
python -m twine upload dist/\*

Metadata

Release files for gitbrowserinteract 0.0.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gitbrowserinteract 0.0.9
File Size Uploaded Provenance
gitbrowserinteract-0.0.9.tar.gz 22.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for gitbrowserinteract 0.0.9
File Interpreter ABI Platform
gitbrowserinteract-0.0.9-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 51.3 kB

Release files / gitbrowserinteract-0.0.9.tar.gz

Download URL gitbrowserinteract-0.0.9.tar.gz
Size 22.8 kB
Tags Source
SHA-256 checksum
How to use checksums
2b531b5dd81dc035bbe43252735d7d697de4ffcbd407ffa83af892b7d43c32c3
BLAKE2b-256 checksum
How to use checksums
17923fb9050d8b0db1b2f33658cf826e16abaa3864ad6a051981ba8f71538f27
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.9

Release files / gitbrowserinteract-0.0.9-py2.py3-none-any.whl

Download URL gitbrowserinteract-0.0.9-py2.py3-none-any.whl
Size 28.6 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
4b95429df27c7d84a3bad7225dadd7360ae132d5db46109b46310525ae7b1a20
BLAKE2b-256 checksum
How to use checksums
c2d594eeb31cd38d24deb7f4d2fdca5dfbb1fe155d6261441036a533fb60e042
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.9

Security for gitbrowserinteract 0.0.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page