@ieportals/gh-secrets-from-env
v1.0.1
Published
Upload key/value pairs from an env file to GitHub repository secrets via gh CLI
Readme
gh-secrets-from-env
Upload key/value pairs from an env file into GitHub Actions repository secrets using the GitHub CLI.
See CHANGELOG.md for release notes.
File in this repo
src/cli.ts: Commander-based TypeScript CLI that reads an env file and runsgh secret setfor each validKEY=VALUEentry.
Prerequisites
- Node.js installed
- GitHub CLI installed (
ghcommand available) - Logged in with GitHub CLI:
gh auth login - Permission to manage secrets in the target repository
Run Without Installing
npx @ieportals/gh-secrets-from-env ENV_FILE REPO- Runs from npm without local install.
- For pnpm users after publish:
pnpm dlx @ieportals/gh-secrets-from-env ENV_FILE REPO ENV_FILEis required.REPOis required.
Local Development
npm install
npm run build
node dist/cli.js ENV_FILE REPOTarget repository
npx @ieportals/gh-secrets-from-env .env.production owner/repoAccepted env file format
# comments are ignored
API_KEY=abc123
DATABASE_URL="postgres://user:pass@host/db"
export REDIS_URL=redis://localhost:6379Example
npx @ieportals/gh-secrets-from-env .env.test owner/repoOutput will include each key as it is uploaded and a final count.
Troubleshooting
Error: GitHub CLI (gh) is not installed.- Install GitHub CLI and re-run.
Error: Env file not found: ...- Check the file path.
ghpermission/auth errors- Run
gh auth statusand ensure you have repo admin/secret permissions.
- Run
