https://github.com/boomit/github-config-manager
Manage GitHub repository secrets and variables across multiple repositories effortlessly with GitHub CLI automation.
https://github.com/boomit/github-config-manager
automation ci-cd configuration-management devops github-actions github-api python secrets-management
Last synced: 6 months ago
JSON representation
Manage GitHub repository secrets and variables across multiple repositories effortlessly with GitHub CLI automation.
- Host: GitHub
- URL: https://github.com/boomit/github-config-manager
- Owner: boomit
- Created: 2025-07-07T13:26:12.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2025-07-07T14:53:13.000Z (7 months ago)
- Last Synced: 2025-07-07T14:55:59.515Z (7 months ago)
- Topics: automation, ci-cd, configuration-management, devops, github-actions, github-api, python, secrets-management
- Language: Python
- Homepage:
- Size: 24.4 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ๐ github-config-manager
> **License:** MIT
> **Python Version:** 3.9+
**`github-config-manager`**๋ GitHub CLI(`gh`)๋ฅผ ํ์ฉํ์ฌ **์ฌ๋ฌ GitHub ๋ฆฌํฌ์งํ ๋ฆฌ์ Secrets ๋ฐ Variables๋ฅผ ์ผ๊ด์ ์ผ๋ก ๊ด๋ฆฌ**ํ๊ณ ์๋ํํ ์ ์๋ ๊ฐ๋ ฅํ ๋๊ตฌ์
๋๋ค.
์กฐ์ง ๋ด ๋ฆฌํฌ์งํ ๋ฆฌ ์ค์ ์ ์ผ๊ด๋๊ฒ ์ ์งํ๊ฑฐ๋ ๋๋ ์
๋ฐ์ดํธ๊ฐ ํ์ํ ๊ฒฝ์ฐ์ ํนํ ์ ์ฉํฉ๋๋ค.
---
## โจ ์ฃผ์ ๊ธฐ๋ฅ
- ๐ **Secrets ๋ฐ Variables ์ผ๊ด ์ญ์ **
์ง์ ๋ ํญ๋ชฉ๋ค์ ์ฌ๋ฌ ๋ฆฌํฌ์งํ ๋ฆฌ์์ ํ ๋ฒ์ ์ญ์ ํฉ๋๋ค.
- ๐ ๏ธ **Secrets ๋ฐ Variables ์ผ๊ด ์ค์ /์
๋ฐ์ดํธ**
์ฌ๋ฌ ๋ฆฌํฌ์งํ ๋ฆฌ์ ๋์ผํ ๊ฐ๋ค์ ๋น ๋ฅด๊ฒ ์ค์ ํ๊ฑฐ๋ ์
๋ฐ์ดํธํฉ๋๋ค.
`--force` ์ต์
์ ํตํด ๋ฎ์ด์ฐ๊ธฐ ์ฌ๋ถ๋ฅผ ์ ์ดํ ์ ์์ต๋๋ค.
- ๐ **๋ฆฌํฌ์งํ ๋ฆฌ ์๋ ํ์**
GitHub ์กฐ์ง ๋๋ ์ฌ์ฉ์ ๊ณ์ ์ ๋ชจ๋ ๋ฆฌํฌ์งํ ๋ฆฌ๋ฅผ ์๋์ผ๋ก ํ์ํ์ฌ ๋์ ๋ฆฌ์คํธ๋ก ์ฌ์ฉํฉ๋๋ค.
- ๐ฏ **ํน์ ๋ฆฌํฌ์งํ ๋ฆฌ๋ง ์ง์ ๊ฐ๋ฅ**
ํ์ผ(`--tr`)์ ํตํด ํน์ ๋ฆฌํฌ์งํ ๋ฆฌ ๋ชฉ๋ก๋ง ๋์์ผ๋ก ์์
ํ ์ ์์ต๋๋ค.
- โ๏ธ **๋ณ๋ ฌ ์ฒ๋ฆฌ ์ง์**
๋ค์์ ๋ฆฌํฌ์งํ ๋ฆฌ๋ฅผ ์ฌ๋ฌ ์ค๋ ๋๋ก ๋ณ๋ ฌ ์ฒ๋ฆฌํ์ฌ ์์
์๋๋ฅผ ๋ํญ ํฅ์์ํต๋๋ค.
- โ
**์์
์ ์ฌ์ฉ์ ํ์ธ ์์ฒญ**
์ค์ ์์
์ํ ์ , ์์
๋์๊ณผ ๋ด์ฉ์ ์ฌ์ฉ์์๊ฒ ๋ช
ํํ ๋ณด์ฌ์ฃผ๊ณ ์ต์ข
ํ์ธ์ ๋ฐ์ต๋๋ค.
- ๐ **์ค์๊ฐ ์งํ ์ํฉ ๋ฐ ์์ธ ๋ก๊ทธ ์ถ๋ ฅ**
๊ฐ ๋ฆฌํฌ์งํ ๋ฆฌ์ ์์
๊ฒฐ๊ณผ๋ฅผ ํ์ธ ๊ฐ๋ฅํ๋ฉฐ, ์ ์ฒด ์งํ ์ํฉ์ ์ค์๊ฐ์ผ๋ก ํ์ํฉ๋๋ค.
- ๐ **์์
์ค๋จ ๊ธฐ๋ฅ ์ ๊ณต**
์คํ ๋์ค ์ธ์ ๋ ์ง `'q' + Enter`๋ฅผ ์
๋ ฅํ์ฌ ์์ ํ๊ฒ ์์
์ ์ค๋จํ ์ ์์ต๋๋ค.
---
## ๐ ์์ํ๊ธฐ
### ๐ ์ ์ ์กฐ๊ฑด
- Python 3.9 ์ด์
- GitHub CLI (`gh`) ์ค์น ๋ฐ ๋ก๊ทธ์ธ ํ์
๐ ์ค์น ๊ฐ์ด๋: https://cli.github.com/
๐ ๋ก๊ทธ์ธ: `gh auth login`
- ํ์ GitHub ๊ถํ (Scopes):**
`github-config-manager`๊ฐ Secrets ๋ฐ Variables ์์
์ ์ฑ๊ณต์ ์ผ๋ก ์ํํ๋ ค๋ฉด, `gh auth login` ์ ๋ฐ๊ธ๋ฐ๋ GitHub Personal Access Token (PAT)์ ๋ค์ ๊ถํ(Scope)์ด ๋ถ์ฌ๋์ด์ผ ํฉ๋๋ค.
* `repo`: ๋ฆฌํฌ์งํ ๋ฆฌ Secrets ๋ฐ Variables๋ฅผ ์ฝ๊ณ , ์ฐ๊ณ , ์ญ์ ํ๋ ๋ฐ ํ์ํฉ๋๋ค.
* `read:org`: (์ ํ ์ฌํญ) ํน์ ์กฐ์ง์ ๋ชจ๋ ๋ฆฌํฌ์งํ ๋ฆฌ ๋ชฉ๋ก์ ๊ฐ์ ธ์ฌ ๋ ํ์ํฉ๋๋ค. ๊ฐ์ธ ๋ฆฌํฌํ ๋ฆฌ๋ง ๊ด๋ฆฌํ๋ค๋ฉด ํ์๋ ์๋๋๋ค.
์ด ๊ถํ๋ค์ `gh auth login` ๊ณผ์ ์์ GitHub CLI๊ฐ ์๋์ผ๋ก ์ ์ํ๊ฑฐ๋, ์ฌ์ฉ์๊ฐ ๋ช
์์ ์ผ๋ก ์ ํํ ์ ์์ต๋๋ค.
### ๐ฆ ์ค์น
```bash
git clone https://github.com/your-username/github-config-manager.git
cd github-config-manager
pip install -r requirements.txt
```
---
### ์ฌ์ฉ๋ฒ
'main.py' ์คํฌ๋ฆฝํธ๋ฅผ ์ฌ์ฉํ์ฌ ์์
์ ์ํํฉ๋๋ค. ๋ค์ํ ๋ช
๋ น์ค ์ธ์๋ฅผ ํตํด Secret ๋ฐ Variable ์์
๋ฐฉ์์ ์ ์ดํ ์ ์์ต๋๋ค.
```bash
python main.py --help
```
์์:
1. ํน์ ์กฐ์ง์ ๋ชจ๋ ๋ฆฌํฌ์งํ ๋ฆฌ์์ Secret ์ญ์ :
'my-org' ์กฐ์ง์ ๋ชจ๋ ๋ฆฌํฌ์งํ ๋ฆฌ์์ 'OLD_SECRET'์ด๋ผ๋ Secret์ ์ญ์ ํฉ๋๋ค.
echo "OLD_SECRET" > secrets_to_delete.txt
python main.py -o my-org -ds secrets_to_delete.txt
2. ์๋ก์ด Secret ๋ฐ Variable ์ค์ /์
๋ฐ์ดํธ (๊ธฐ์กด ์กด์ฌ ์ ๊ฑด๋๋ฐ๊ธฐ):
'my-org' ์กฐ์ง์ ๋ชจ๋ ๋ฆฌํฌ์งํ ๋ฆฌ์ 'NEW_SECRET=value1' Secret๊ณผ 'APP_VERSION=1.0' Variable์ ์ค์ ํฉ๋๋ค. ์ด๋ฏธ ์กด์ฌํ๋ฉด ๊ฑด๋๋๋๋ค.
echo "NEW_SECRET=value1" > secrets.env
echo "APP_VERSION=1.0" > variables.env
python main.py -o my-org -s secrets.env -v variables.env
3. ํน์ ๋ฆฌํฌ์งํ ๋ฆฌ ๋ชฉ๋ก์ Secret ๊ฐ์ ์
๋ฐ์ดํธ:
'target_repos.txt'์ ๋์ด๋ ๋ฆฌํฌ์งํ ๋ฆฌ์์ 'API_KEY' Secret์ ๊ฐ์ ๋ก ์
๋ฐ์ดํธํฉ๋๋ค.
```bash
# target_repos.txt ์์:
# my-org/repo-a
# another-org/repo-b
```
```bash
echo "API_KEY=new_super_secret" > api_key.env
python main.py -tr target_repos.txt -s api_key.env --force
```
4. ๋ค์ค ์์ปค(๋ณ๋ ฌ ์ฒ๋ฆฌ)๋ฅผ ์ฌ์ฉํ์ฌ Secret ๋ฐ Variable ์ญ์ /์ค์ :
'my-org' ์กฐ์ง์ ๋ฆฌํฌ์งํ ๋ฆฌ๋ฅผ 5๊ฐ์ ์์ปค(์ค๋ ๋)๋ก ๋ณ๋ ฌ ์ฒ๋ฆฌํฉ๋๋ค.
```bash
echo "SECRET_TO_DELETE" > delete_secrets.txt
echo "VAR_TO_SET=value" > set_vars.txt
python main.py -o my-org -ds delete_secrets.txt -v set_vars.txt -w 5
```
### ์ธ์ (Arguments)
๋จ์ถ | ์ ์ฒด ์ธ์ | ์ค๋ช
| ํ์
:--- | :--------------- | :----------------------------------------------------------------------------- | :---
-o | --organization | ์์
ํ GitHub ์กฐ์ง ๋๋ ์ฌ์ฉ์ ์ด๋ฆ (์: 'my-org' ๋๋ 'my-username') | ์
-s | --secrets-file | ์ค์ ํ Secret ์ด๋ฆ๊ณผ ๊ฐ์ ํฌํจํ๋ ํ์ผ ๊ฒฝ๋ก (์: 'SECRET_NAME=VALUE') | ์๋์ค
-v | --values-file | ์ค์ ํ Variable ์ด๋ฆ๊ณผ ๊ฐ์ ํฌํจํ๋ ํ์ผ ๊ฒฝ๋ก (์: 'VAR_NAME=VALUE') | ์๋์ค
-ds | --ds | ์ญ์ ํ Secret ์ด๋ฆ ๋ชฉ๋ก์ ํฌํจํ๋ ํ์ผ ๊ฒฝ๋ก (ํ ์ค์ ํ๋์ฉ) | ์๋์ค
-dv | --dv | ์ญ์ ํ Variable ์ด๋ฆ ๋ชฉ๋ก์ ํฌํจํ๋ ํ์ผ ๊ฒฝ๋ก (ํ ์ค์ ํ๋์ฉ) | ์๋์ค
-tr | --tr | ์์
์ ์ํํ ํน์ ๋ฆฌํฌ์งํ ๋ฆฌ ๋ชฉ๋ก์ ํฌํจํ๋ ํ์ผ ๊ฒฝ๋ก (ํ ์ค์ ํ๋์ฉ, 'repo' ํ์). ์ง์ ํ์ง ์์ผ๋ฉด organization๋ด์ ๋ชจ๋ repo์ ์ ์ฉ | ์๋์ค
-w | --workers | ๋์์ ์ฒ๋ฆฌํ ์ต๋ ์์ปค(์ค๋ ๋) ์ (๊ธฐ๋ณธ๊ฐ: '1' - ์์ฐจ ์ฒ๋ฆฌ) | ์๋์ค
-sl | --sleep | ๊ฐ ๋ฆฌํฌ์งํ ๋ฆฌ ์ฒ๋ฆฌ ํ ๋๊ธฐ ์๊ฐ(์ด) (์์ฐจ ์ฒ๋ฆฌ ์ ์ ์ฉ, ๊ธฐ๋ณธ๊ฐ: '0') | ์๋์ค
-f | --force | Secret/Variable ์ค์ ์ ๊ธฐ์กด ๊ฐ์ ๊ฐ์ ๋ก ๋ฎ์ด์ธ์ง ์ฌ๋ถ (๊ธฐ๋ณธ๊ฐ: 'False') | ์๋์ค
---
### ํ์ผ ํฌ๋งท
1. --secrets-file, --values-file ํฌ๋งท
```txt
# secrets.env ํ์ผ ์์:
MY_API_KEY=your_secret_or_value_here
DATABASE_URL=postgres://user:pass@host:port/dbname
```
2. --ds, --dv ํฌ๋งท
```txt
# secrets_to_delete.txt ํ์ผ ์์:
MY_API_KEY
DATABASE_URL
```
3. --tr
```txt
repo-name1
repo-name2
repo-name3
```
## ๊ธฐ์ฌํ๊ธฐ
๊ธฐ์ฌ๋ ์ธ์ ๋ ํ์์
๋๋ค! ๋ฒ๊ทธ ๋ณด๊ณ , ๊ธฐ๋ฅ ์ ์, ์ฝ๋ ๊ฐ์ ๋ฑ ์ด๋ค ํํ์ ๊ธฐ์ฌ๋ผ๋ ์ข์ต๋๋ค.
1. ์ด ์ ์ฅ์๋ฅผ Fork ํฉ๋๋ค.
2. ์๋ก์ด Feature Branch๋ฅผ ์์ฑํฉ๋๋ค ('git checkout -b feature/AmazingFeature').
3. ๋ณ๊ฒฝ ์ฌํญ์ Commit ํฉ๋๋ค ('git commit -m 'Add some AmazingFeature'').
4. Branch๋ฅผ Push ํฉ๋๋ค ('git push origin feature/AmazingFeature').
5. Pull Request๋ฅผ ์ฝ๋๋ค.
---
## โจ ํ๋ก์ ํธ๊ฐ ์ ์ฉํ์
จ๋ค๋ฉด?
์ด ํ๋ก์ ํธ๊ฐ ๋ง์์ ๋์
จ๊ฑฐ๋ ์ ์ฉํ๊ฒ ์ฌ์ฉํ์
จ๋ค๋ฉด, GitHub์์ **Star**๋ฅผ ๋๋ฌ์ฃผ์ธ์! ์ฌ๋ฌ๋ถ์ ๊ด์ฌ์ ํ๋ก์ ํธ ๋ฐ์ ์ ํฐ ํ์ด ๋ฉ๋๋ค.
---
## ๋ผ์ด์ ์ค
์ด ํ๋ก์ ํธ๋ MIT ๋ผ์ด์ ์ค์ ๋ฐ๋ผ ๋ฐฐํฌ๋ฉ๋๋ค. ์์ธํ ๋ด์ฉ์ 'LICENSE' ํ์ผ์ ์ฐธ์กฐํ์ธ์.