Skip to content

Instantly share code, notes, and snippets.

@jun784
Created August 15, 2024 11:46
Show Gist options
  • Save jun784/cd5fe0e271fb429b367e57f8425ba0de to your computer and use it in GitHub Desktop.
Save jun784/cd5fe0e271fb429b367e57f8425ba0de to your computer and use it in GitHub Desktop.
add-secret-to-gh.sh
#!/bin/bash
# .env.localファイルを読み込む
set -a
source .env.local
set +a
# GitHubリポジトリの情報
REPO_OWNER="your-username"
REPO_NAME="your-repo"
# 環境変数をGitHubシークレットに追加する
for var in $(cat .env.local | grep -v '^#' | sed 's/=.*//'); do
gh secret set $var -b"${!var}" -R $REPO_OWNER/$REPO_NAME
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment