C.W.K.
Stream
Lesson 03 of 12 · published

Organization secret

~9 min · org, secrets, scope

Level 0Apprentice
0 XP0/101 lessons0/10 achievements
0/120 XP to next level120 XP to go0% complete

한 번 공유, 여러 repo 에서 사용

Org 에 30 repo 가 다 AWS 에 deploy 해야 하면, AWS 키를 30 개 repo secret 세트로 복붙 하는 건 유지 + rotation 악몽. Organization secret 이 정확히 이 경우용.

설정: Org Settings → Secrets and variables → Actions → New organization secret. 그 다음 visibility 선택:

  • All repositories — org 의 모든 repo 가 봄.
  • Private repositories — private/internal repo 만.
  • Selected repositories — 명시 리스트.

해석 순서

Org 와 repo 가 같은 이름 secret 을 정의하면 repo 값이 이김. 단일 repo 에서 org level default 덮어쓰기 유용.

언제 어느 거 쓸까

  • Org secret — 여러 repo 공유 credential: cloud provider key, registry token, 공통 API key.
  • Repo secret — 한 프로젝트 특정 credential, 또는 org level 값 override.
  • Environment secret — deploy 타겟에 묶인 credential (다음 lesson).

Code

선택된 repo 와 함께 org secret 설정·bash
# Set an org secret limited to specific repos
gh secret set AWS_ACCESS_KEY_ID \
  --org my-org \
  --visibility selected \
  --repos my-org/api,my-org/web,my-org/jobs \
  --body "$AWS_KEY"

# In any of those repos' workflows:
#    env:
#      AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}

External links

Exercise

Secret 공유하는 multiple repo 가진 org 있으면 'Selected repositories' visibility 인 org secret 으로 마이그레이션. Repo 들에서 중복 repo secret 제거. CI 통과 확인.

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고

댓글 0

🔔 답글 알림 (로그인 필요)
로그인댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.