Skip to main content

A simple CLI to manage GitHub secrets, that are used with GitHub Actions

Project description

githubsecrets

testing

GithubSecrets-Website

A simple CLI to manage GitHub secrets, that are used with GitHub Actions

GIF Demo

Usage-Demo

Installation

pip

Python v3.6.7 and above

Install with pip on your machine; the package is available at PyPi

$ pip install githubsecrets

Docker

Mount local directory to root, the image is available at DockerHub

The image runs as a CLI; you must provide arguments, prompts are not available while running in Docker

Linux and macOS

Mount your home directory, or any other directory to save the credentials file

$ docker run -v $HOME:/root unfor19/githubsecrets --help
Usage: ghs [OPTIONS] COMMAND [ARGS]...
...

Windows

Mount your Temp directory, or any other directory to save the credentials file. Make sure you use / and not \

$ docker run --rm -v c:/Temp:/root unfor19/githubsecrets --help
Usage: ghs [OPTIONS] COMMAND [ARGS]...
...

Build from source

$ git clone https://github.com/unfor19/githubsecrets.git && cd githubsecrets
...
$ pip install --upgrade pip
...
$ pip install -r requirements.txt
...
$ pip install --editable .
...
# Done!

Getting Started

Note: When using Docker, no need to add ghs; supply only a command and its arguments

  1. Initialize this application - Creates a credential file at ~/.githubsecrets/credentials

    $ ghs init
    
  2. Generate a GitHub Personal-Access-Token with the following permssions:

    • repo (all)
    • admin:public_key > read:public_key
  3. Save the token in a safe place; we'll use it in the next step

  4. Create a profile, use the -p flag and supply a profile name

    $ ghs profile-apply -p willy_wonka
    ...
    SUCCESS: Applied the profile willy_wonka
    

    You'll be prompted to insert:

    • Github owner - which is your GitHub Organization or GitHub Account name (not email address)
    • Personal access token - that you've created in the previous steps
  5. Create a GitHub secret

    ghs secret-apply -p willy_wonka -r github-secrets
    

    You'll be prompted to insert:

    • Secret name
    • Secret value

Status codes

  • 200 - success
  • 204 - success
  • 404 - secret or repository not found

Available commands

View all available commands with ghs --help

Usage: ghs [OPTIONS] COMMAND [ARGS]...

All commands can run without providing options, and then you'll be
prompted to insert values.

Secrets' values and Personal-Access-Tokens are hidden when prompted

Options:
--help Show this message and exit.

Commands:
init Create a credentials file to store your profiles
profile-apply Create or modify a profile
profile-delete Delete a profile
profile-list List all profile - truncates personal access tokens
secret-apply Create or modify a secret in a GitHub repository
secret-delete Delete a secret in a GitHub repository
secret-get Get a secret from a GitHub repository
secret-list List all secret in a GitHub repository

Contributing

Report issues/questions/feature requests on in the Issues section.

Pull requests are welcome! Ideally, create a feature branch and issue for every single change you make. These are the steps:

  1. Fork this repo
  2. Create your feature branch from master (git checkout -b my-new-feature)
  3. Commit your remarkable changes (git commit -am 'Added some feature')
  4. Push to the branch (git push --set-up-stream origin my-new-feature)
  5. Create a new Pull Request and tell us about your changes

Authors

Created and maintained by Meir Gabay

Design by facebook.com/KerenOrDesign

License

This project is licensed under the MIT License - see the LICENSE file for details

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

githubsecrets-1.0.0.tar.gz (6.7 kB view hashes)

Uploaded Source

Built Distribution

githubsecrets-1.0.0-py3-none-any.whl (8.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page