0.1.28 • Published 6 days ago

@scloud/cdk-github v0.1.28

Weekly downloads
-
License
MIT
Repository
github
Last release
6 days ago

CDK Github secrets and variables

This is a companion package designed to work with @scloud/cdk-patterns:` https://www.npmjs.com/package/@scloud/cdk-patterns

Takes outputs produced by the githubActions().ghaOidcRole() and githubActions().ghaUser() features of @scloud/cdk-patterns and automates setting repo/environment secrets and variables in Github Actions.

This is intended to provide you with the environment/variable/secret handling capabilities you'll mostly need. If you have an edge-case, the repo serves as example code you can reuse to help you get what you need done more easily.

Setup

Assuming you've called the ghaOidcRole or ghaUser function, you should have some output files under your .infrastructure/secrets directory, e.g.:

  • .infrastructure/secrets/StackName.ghaSecrets.json
  • .infrastructure/secrets/StackName.ghaVariables.json

@scloud/cdk-github uses these files as inputs to understand the values that need to be set on the repo (or its environments) and whether or not the value needs to be handled as a secret.

Running

To set variables and/or secrets, you can use the following example code:

import { updateGithub } from '@scloud/cdk-github';

(async () => {
  await updateGithub();
})();

The key part is the call to the updateGithub function.

You can optionally pass true to this function if you would like this process to delete any "leftover" (orphaned) values. This removes secrets and variables if they are no longer specified by the stack. However, be aware tht this will delete any variables you've set manually! Passing true is recommended to fully automate and keep the set of variables and secrets clean.

You will also need the following environment variables, or pass an object with these values when you call the function:

export USERNAME=octocat
export PERSONAL_ACCESS_TOKEN=ghp_xxxxxxxxxxx
export OWNER=organization
export REPO=repository

or

{
  username: 'octocat',
  personalAccessToken: 'ghp_xxxxxxxxxxx',
  owner: 'organization',
  repo: 'repository',
}
0.1.28

6 days ago

0.1.27

5 months ago

0.1.26

5 months ago

0.1.25

11 months ago

0.1.24

11 months ago

0.1.23

11 months ago

0.1.22

11 months ago

0.1.21

11 months ago

0.1.20

11 months ago

0.1.19

11 months ago

0.1.18

11 months ago

0.1.17

11 months ago

0.1.16

11 months ago

0.1.15

11 months ago

0.1.14

11 months ago

0.1.13

11 months ago

0.1.12

11 months ago

0.1.11

11 months ago

0.1.10

11 months ago

0.1.9

11 months ago

0.1.8

11 months ago

0.1.4

11 months ago

0.1.3

11 months ago

0.1.2

11 months ago

0.1.1

11 months ago

0.1.0

11 months ago