Git Product home page Git Product logo

gh-secrets's Introduction

GitHub action secrets CLI

npm Publish NPM package Publish Docker image License

โš ๏ธ DEPRECATED: this project will not be longer maintained, instead, GitHub has published a gh cli to manage secrets among other features of its ecosystem.

GitHub actions secrets management CLI tool

Available in:

Features

Repository

  • List repository secrets
  • Get a repository secret
  • Create or update a repository secret
  • Create or update a batch of repository secrets
  • Delete a repository secret

Organization

  • List organization secrets
  • Get an organization secret
  • Create or update an organization secret
  • Create or update a batch of organization secrets
  • Delete an organization secret
  • List selected repositories for an organization secret
  • Set selected repositories for an organization secret
  • Add selected repository to an organization secret
  • Remove selected repository from an organization secret

Setup

  1. Generate a GitHub Personal Access Token
    • select repo scope permissions to manage repositories level secrets
    • select admin:org scope permissions to manage organization level secrets
    • select repo, admin:org scope permissions to manage repositories and organization level secrets
  2. Save and update .gh-secrets file in the user home directory: cp .gh-secrets.example $HOME/.gh-secrets

Usage

Usage: gh-secrets <command> [options] <url> [parameters]

Commands:
  gh-secrets list <url>                     Lists all secrets available in a repository/organization without revealing their encrypted values
  gh-secrets get <name> <url>               Gets a single secret from a repository/organization without revealing its encrypted value
  gh-secrets set <name> <value> <url> [--visibility all | private | selected]  Creates or updates a secret in a repository/organization with an encrypted value
  gh-secrets setAll <file> <url> [--visibility all | private | selected] Creates or updates a batch of secrets in a repository/organization with an encrypted values from a file
  gh-secrets delete <name> <url>            Deletes a secret in a repository/organization using the secret name

Options:
  -h, --help     Show help            [boolean]
  -v, --version  Show version number  [boolean]

Examples:
  gh-secrets list https://github.com/owner/repository-name
  gh-secrets get SECRET_NAME https://github.com/owner/repository-name
  gh-secrets set SECRET_NAME value https://github.com/owner/repository-name
  gh-secrets setAll secrets.env https://github.com/owner/repository-name
  gh-secrets delete SECRET_NAME https://github.com/owner/repository-name
  gh-secrets list https://github.com/owner
  gh-secrets get SECRET_NAME https://github.com/owner
  gh-secrets set SECRET_NAME value https://github.com/owner
  gh-secrets set SECRET_NAME value https://github.com/owner --visibility all
  gh-secrets set SECRET_NAME value https://github.com/owner --visibility private
  gh-secrets set SECRET_NAME value https://github.com/owner --visibility selected
  gh-secrets setAll secrets.env https://github.com/owner
  gh-secrets setAll secrets.env https://github.com/owner --visibility all
  gh-secrets setAll secrets.env https://github.com/owner --visibility private
  gh-secrets setAll secrets.env https://github.com/owner --visibility selected
  gh-secrets delete SECRET_NAME https://github.com/owner

Local

  1. Install gh-secrets globally: npm install -g @kijart/gh-secrets
  2. Run examples:
    • help: gh-secrets -h
    • list: gh-secrets list https://github.com/owner/repository-name
    • setAll: gh-secrets setAll /app/secrets.env https://github.com/owner/repository-name

Docker

  1. Build from source: docker pull kijart/gh-secrets

  2. Run examples:

    • help: docker run --rm -it -v $HOME/.gh-secrets:/home/node/.gh-secrets gh-secrets -h

    • list: docker run --rm -it -v $HOME/.gh-secrets:/home/node/.gh-secrets gh-secrets list https://github.com/owner/repository-name

    • setAll:

      docker run --rm -it \
      -v $HOME/.gh-secrets:/home/node/.gh-secrets \
      -v $(pwd)/secrets.env:/app/secrets.env \
      kijart/gh-secrets setAll /app/secrets.env https://github.com/owner/repository-name`

Docker Compose

  1. Build docker service: docker-compose up --no-start
  2. Run examples:
    • help: docker-compose run --rm gh-secrets -h
    • list: docker-compose run --rm gh-secrets list https://github.com/owner/repository-name
    • setAll: docker-compose run --rm gh-secrets setAll secrets.env https://github.com/owner/repository-name

Install from source

  1. Install project dependencies: npm install
  2. Install project binary globally: npm install -g .
  3. Update $HOME/.gh-secrets content with valid values
  4. Run examples:
    • help: gh-secrets -h
    • list: gh-secrets list https://github.com/owner/repository-name
    • setAll: gh-secrets setAll /app/secrets.env https://github.com/owner/repository-name

Documentation

gh-secrets's People

Contributors

dependabot[bot] avatar kijart avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.