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

Event (Trigger)

~12 min · events, triggers, on

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

'on' block 이 scheduler

모든 workflow 는 on: 아래 trigger 를 선언해. 가장 흔한 trigger 들, 대략 쓸 순서대로:

  • push — 모든 push 시 발사. Branch, tag, path 로 필터링 가능.
  • pull_request — PR open, sync (새 commit), reopen 등 시 발사. Branch, path, type 으로 필터링.
  • schedule — cron 스타일, UTC. '0 6 * * *' = 매일 06:00 UTC.
  • workflow_dispatch — UI/API/CLI 에서 수동 trigger. Input first-class.
  • release — release event (created, published, edited) 시 발사.
  • workflow_call — 다른 workflow 가 호출 가능하게 (reusable workflow).
  • repository_dispatch — 외부 시스템이 POST 로 발사.
  • merge_group — merge queue 안에서 발사.

Filter 가 trigger 를 좁혀

그냥 on: push 는 거의 안 원해. main 으로 pushsource 파일이 변경된 push 를 원하지. 각 event 아래 filter:

  • branches / branches-ignore
  • tags / tags-ignore
  • paths / paths-ignore — 변경 파일에 매칭되는 glob.
  • types — sub-type 있는 event (PR opened/synchronized/reopened) 용.

Code

Filter 가 있는 mixed trigger·yaml
name: ci
on:
  pull_request:
    types: [opened, synchronize, reopened, ready_for_review]
    paths:
      - 'src/**'
      - 'tests/**'
      - '.github/workflows/ci.yml'
  push:
    branches: [main]
    tags: ['v*.*.*']
  schedule:
    - cron: '0 6 * * *'   # 06:00 UTC daily
  workflow_dispatch:
    inputs:
      reason:
        description: 'Why are you running this?'
        required: true

External links

Exercise

Sandbox repo 에서 세 가지 다른 event 에 발사되는 workflow 하나 짜: main push, pull_request, input 한 개 있는 workflow_dispatch. 어느 trigger 가 발사됐는지 알게 각각 다른 메시지 echo.

Progress

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

댓글 0

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

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