npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@scloud/cdk-github

v0.1.28

Published

Automates setting variables and secrets on a Github repo/environment based on output produced by the ghaUser() feature of @scloud/cdk-patterns

Downloads

35

Readme

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',
}