Skip to content

Platane/github-secret-dotenv

Repository files navigation

Github Secret DotEnv (github-secret-dotenv)

type definitions code style npm GitHub Workflow Status

Upload secrets to github from your .env file

terminal screenshot

Usage

cli

npx github-secret-dotenv \

  --repository platane/github-secret-dotenv \
  # The github repository (<owner>/<repo>)
  # If omitted, read it from the package.json

  --dotEnvFilename ./.env \
  # The .env file to read
  # Default to .env

  --githubAccessToken xxxx
  # Your github access token
  # If omitted, read it from GITHUB_ACCESS_TOKEN env var
  # Generate one from https://github.com/settings/tokens/new
  # Must have permissions [public_repo  read:public_key]

  --delete
  # When set, remove all secrets that are not in the .env

node api

import { readAndUpload, createSecretUpdater } from "github-secret-dotenv";

// upload the content of .env as secrets for the github repository
await readAndUpload({
  owner: "platane",
  repo: "github-secret-dotenv",
  githubAccessToken: "xxxx",
  dotEnvFilename: ".env",
});

// upload arbitrary secret to the github repository
const updateSecret = createSecretUpdater({
  owner: "platane",
  repo: "github-secret-dotenv",
  githubAccessToken: "xxxx",
});
updateSecret("MY_SECRET", "XXXX");

License

MIT