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

수동 입력 (workflow_dispatch)

~9 min · dispatch, inputs, manual

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

On-demand pipeline

workflow_dispatch 가 Actions UI 에 'Run workflow' 버튼 노출 (CLI 의 gh workflow run + API 도). Ad-hoc 작업의 옳은 trigger: 수동 deploy, 일회성 backfill, 디버그 세션.

Typed input

  • string (기본).
  • boolean — UI 체크박스.
  • number.
  • choiceoptions: 드롭다운.
  • environment — repo environment 드롭다운.

CLI 에서 trigger

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

왜 runner SSH 보다 나은가

  1. 감사 로그 — 모든 dispatch 기록.
  2. Auth — dispatching 사용자로 실행, secret 과 permission 적용.
  3. 재현 가능 — YAML 이 script.
  4. 가시성 — 누구나 뭐가 도는지, 뭐가 돌았는지 봄.

Code

풍부한 input 가진 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 해서 하는 운영 작업 하나 골라. Typed input 가진 workflow_dispatch 로 재구현. UI 에서 한 번, gh workflow run 으로 한 번 실행.

Progress

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

댓글 0

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

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