encrypt-secret-value-for-gh-actions

command module
v0.0.0-...-d8f41ea Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 17, 2023 License: MIT Imports: 6 Imported by: 0

README

encrypt-secret-value-for-gh-actions

A Golang example of encrypting secrets in order to programmatically write them to the GitHub Actions Secrets API. This is not to be used an extension or program, but as an example that you can place in your own code.

Prerequisites

Usage

You'll need your repositories public key in order to encrypt a value. See the examaple below once you've retreived the public key.

1. Get Repo Public Key

  1. Install GH CLI

  2. Authenticate with your user who owns the repo you want the public key for (see authentication instructions)

  3. Execute in terminal (replace <owner-of-repo> and <repo-name> respectively):

    gh api -q ".key" /repos/<owner-of-repo>/<repo-name>/actions/secrets/public-key
    

2. Example

  1. Clone this repository

  2. Execute in terminal:

    go get
    # replace <secret-value> and <repo-public-key> with real values
    go run encrypt.go "<secret-value>" "<repo-public-key>"
    

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL