C.W.K.
Stream
Lesson 11 of 13 · published

CI 위한 GitHub App

~10 min · github-apps, auth, integration

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

PAT 가 부족할 때

Personal Access Token (PAT) 은 사용자 계정에 묶임. 사용자 떠나면 만료, 사용자가 가진 권한, '자기 자신으로' 행동해야 하는 자동화에 안 scale.

GitHub App 은 first-class ID. Org 이나 특정 repo 에 설치, fine-grained 권한 부여, JWT + 단기 installation token 으로 인증. 대부분 자동화는 GitHub App 이어야.

유즈 케이스

  • Cross-repo workflow — repo A 의 workflow 가 repo B 에 write 필요. PAT 은 repo 간 scope 깔끔히 안 됨; GitHub App 은 됨.
  • 봇 계정 — release-please, semantic-release, dependabot — 다 GitHub App 이거나 비슷.
  • 커스텀 통합 — Slack bot, custom dashboard, 내부 tooling.
  • 높은 rate limit — App token 이 PAT 보다 API rate limit 높음.

Auth flow

  1. App 의 private key 로 서명한 JWT 생성.
  2. JWT 를 installation token (~1 시간) 으로 교환.
  3. API 호출 / git 작업에 installation token 사용.

Action: actions/create-github-app-token 이 dance 를 처리. Output 은 token; 다음 step 에 env 통해 전달.

Code

App token 통한 cross-repo write·yaml
  cross-repo:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/create-github-app-token@v1
        id: app
        with:
          app-id: ${{ vars.MY_BOT_APP_ID }}
          private-key: ${{ secrets.MY_BOT_APP_PRIVATE_KEY }}
          owner: my-org
          repositories: target-repo
      - run: |
          curl -H "Authorization: Bearer ${{ steps.app.outputs.token }}" \
            -X POST https://api.github.com/repos/my-org/target-repo/dispatches \
            -d '{"event_type":"deploy-prod"}'

External links

Exercise

Cross-repo 자동화 있으면 어떻게 인증하는지 audit. PAT? GitHub App 으로 마이그레이션. App 의 권한과 어느 repo 에 설치됐는지 문서화 — 다음에 쓸 사람이 dance 재발명 안 하게.

Progress

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

댓글 0

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

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