Discover Packages
github.com/samueljmello/encrypt-secret-value-for-gh-actions
command
module
Version:
v0.0.0-...-d8f41ea
Opens a new window with list of versions in this module.
Published: Aug 17, 2023
License: MIT
Opens a new window with license information.
Imports: 6
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
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
Install GH CLI
Authenticate with your user who owns the repo you want the public key for (see authentication instructions )
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
Clone this repository
Execute in terminal:
go get
# replace <secret-value> and <repo-public-key> with real values
go run encrypt.go "<secret-value>" "<repo-public-key>"
Expand ▾
Collapse ▴
Documentation
¶
There is no documentation for this package.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.