본문 바로가기
C.W.K.
Stream
Lesson 12 of 14 · published

수동 입력 (workflow_dispatch)

~9 min · dispatch, inputs, manual

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

주문형 파이프라인

workflow_dispatch를 쓰면 Actions UI에 'Run 워크플로' 버튼이 나타나. CLI의 gh workflow run 명령어나 API로도 실행할 수 있어. 수동 배포, 일회성 백필, 디버그 세션 같은 임시 작업에 딱 맞는 실행 조건이야.

타입이 지정된 입력값

  • string (기본값).
  • boolean — UI에서 체크박스로 표시돼.
  • number.
  • choiceoptions:로 드롭다운을 만들 수 있어.
  • environment — 저장소 환경을 선택하는 드롭다운이야.

CLI에서 실행하기

gh workflow run deploy.yml -f env=production -f version=v1.4.2

러너 SSH보다 나은 이유

  1. 감사 로그 — 모든 디스패치 기록이 남아.
  2. 인증 — 디스패치를 실행한 사용자 권한으로 돌아가서 비밀값과 권한이 그대로 적용돼.
  3. 재현 가능 — YAML 파일 자체가 스크립트 역할을 해.
  4. 가시성 — 누구나 지금 뭐가 돌고 있는지, 과거에 뭐가 돌았는지 확인할 수 있어.

Code

풍부한 입력값을 가진 workflow_dispatch·yaml
name: deploy
on:
  workflow_dispatch:
    inputs:
      env:
        type: environment
        required: true
      version:
        type: string
        required: true
        description: 'Semver tag like v1.4.2'
      dry-run:
        type: boolean
        default: true
      force:
        type: choice
        default: 'no'
        options: ['no', 'yes-i-really-mean-it']

jobs:
  deploy:
    runs-on: ubuntu-latest
    environment: ${{ inputs.env }}
    steps:
      - run: |
          echo "Deploying ${{ inputs.version }} to ${{ inputs.env }}"
          if ${{ inputs.dry-run }}; then echo 'DRY RUN'; fi
          if [[ "${{ inputs.force }}" == 'yes-i-really-mean-it' ]]; then echo 'FORCE'; fi

External links

Exercise

지금 서버에 SSH 접속해서 하는 운영 작업 하나 골라봐. 타입이 지정된 입력값을 가진 workflow_dispatch로 다시 구현해 봐. UI에서 한 번, gh workflow run으로 한 번 실행해.

Progress

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

댓글 0

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

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