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

Trigger event 심화

~13 min · events, advanced, fork

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

팀을 곤란하게 하는 trigger 들

pushpull_request 외에 알아둘 미묘한 event type 몇 개 — 대부분 팀이 outage 후 발견해.

pull_request vs pull_request_target

  • pull_requestfork code 의 context 에서 secret 없이 돔. 안전.
  • pull_request_targetbase repo context 에서 전체 secret 으로 돔. 그런 workflow 에서 PR code 를 checkout 하면 위험 — 클래식 'pwn-request' 취약점.
  • pull_request_target 는 라벨링, comment 게시, metric 계산 용으로만 — PR 작성자 코드 실행 절대 금지.

schedule

  • 항상 UTC.
  • 비활성 repo 에선 disable (60일 commit 없음).
  • Drift: 피크 시 GitHub 가 scheduled run 지연 가능. 밀리초 정확도 의존 금지.

workflow_dispatch

  • Input 은 typed: string (기본), boolean, choice, environment.
  • 일부 UI flow 에서 required input 은 default value 명시 필요.
  • 용도: 수동 deploy, 일회성 backfill, ad-hoc 수정.

workflow_run

  • 다른 workflow 끝날 때 workflow 실행.
  • 유즈 케이스: post-CI deploy, comment 요약, forwarder.
  • Fork 에서도 base repo secret 상속 — 주의.

Code

typed input 있는 workflow_dispatch·yaml
on:
  workflow_dispatch:
    inputs:
      env:
        description: Target environment
        type: choice
        options: [staging, production]
        default: staging
        required: true
      dry-run:
        description: Dry run (no real deploy)
        type: boolean
        default: true
      version:
        description: Version tag to deploy (e.g., v1.4.2)
        type: string
        required: true

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - run: |
          echo "Deploying ${{ inputs.version }} to ${{ inputs.env }}"
          if ${{ inputs.dry-run }}; then echo 'DRY RUN'; fi

External links

Exercise

Repo 에서 pull_request_target 쓰는 workflow audit. 각각 PR 작성자 코드 실행 안 하는지 확인. 한다면 지금 issue 만들거나 고쳐.

Progress

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

댓글 0

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

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