Chapter 03Lesson 05~175 minutes

Checkpoint Lab — Events, Triggers, Filters, Schedules, Manual Runs, and Repository Dispatch

The checkpoint combines the chapter into one reviewable trigger matrix. Before generating any event, you predict which cases should create runs and what ref/SHA each run should expose. You then execute only safe disposable cases, preserve both positive and negative evidence, and explain discrepancies without changing multiple variables at once.

CheckpointTrigger matrixPredictionsEvent evidenceReconciliation

Learning objectives

  • Create a trigger matrix covering push, pull request, manual dispatch, repository dispatch, and schedule semantics.
  • Predict run creation and ref/SHA evidence before each controlled event.
  • Preserve negative evidence when a trigger intentionally creates no run.
  • Reconcile manual/custom dispatch inputs with default-branch workflow requirements and safe shell handling.
  • Produce a complete Chapter 03 evidence packet and bridge to Chapter 04 expression semantics.

1. Checkpoint scope and authorization

Item Required checkpoint state
Repository Disposable learner-owned repository only; default branch main.
Runner ubuntu-24.04 GitHub-hosted runner.
Workflow permissions permissions: {}; workflow only prints bounded metadata.
External actions None.
Credentials No credential in files/logs; optional gh api uses existing authenticated CLI session.
Side effects Disposable commits, one PR, workflow runs, optional custom dispatch event. No package/deployment/cloud mutation.
Schedule Design/inspect required; waiting for an actual scheduled occurrence is optional.

2. Final checkpoint workflow

name: Chapter 03 checkpoint

on:
  push:
    branches:
      - main
      - 'feature/**'
    paths:
      - 'app/**'
      - '.github/workflows/ch03-checkpoint.yml'
  pull_request:
    branches:
      - main
    paths:
      - 'app/**'
      - '.github/workflows/ch03-checkpoint.yml'
  workflow_dispatch:
    inputs:
      scenario:
        description: 'Synthetic scenario label'
        type: choice
        required: true
        options: [smoke, regression]
      dry_run:
        description: 'No external side effects'
        type: boolean
        required: true
        default: true
  repository_dispatch:
    types: [academy_probe]
  schedule:
    - cron: '23 4 * * 1-5'
      timezone: 'Etc/UTC'

permissions: {}

defaults:
  run:
    shell: bash

jobs:
  inspect:
    runs-on: ubuntu-24.04
    env:
      EVENT_NAME: ${{ github.event_name }}
      EVENT_ACTION: ${{ github.event.action }}
      ACTOR: ${{ github.actor }}
      REF: ${{ github.ref }}
      SHA: ${{ github.sha }}
      BASE_REF: ${{ github.base_ref }}
      HEAD_REF: ${{ github.head_ref }}
      PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
      MANUAL_SCENARIO: ${{ inputs.scenario }}
      MANUAL_DRY_RUN: ${{ inputs.dry_run }}
      DISPATCH_SOURCE: ${{ github.event.client_payload.source }}
      DISPATCH_DRY_RUN: ${{ github.event.client_payload.dry_run }}
      SCHEDULE_EXPR: ${{ github.event.schedule }}
    steps:
      - name: Record bounded trigger evidence
        run: |
          printf 'event=%s action=%s actor=%s\n' "$EVENT_NAME" "$EVENT_ACTION" "$ACTOR"
          printf 'ref=%s sha=%s\n' "$REF" "$SHA"
          printf 'base=%s head=%s pr_head_sha=%s\n' "$BASE_REF" "$HEAD_REF" "$PR_HEAD_SHA"
          printf 'manual_scenario=%s manual_dry_run=%s\n' "$MANUAL_SCENARIO" "$MANUAL_DRY_RUN"
          printf 'dispatch_source=%s dispatch_dry_run=%s\n' "$DISPATCH_SOURCE" "$DISPATCH_DRY_RUN"
          printf 'schedule=%s\n' "$SCHEDULE_EXPR"
          printf 'run=%s attempt=%s\n' "$GITHUB_RUN_ID" "$GITHUB_RUN_ATTEMPT"
Safety invariant: all event-derived values are passed through environment variables and quoted. The checkpoint never executes payload text as code and never prints the full event context.

3. Prediction matrix — complete before execution

ID Event Repository change/request Expected run? Expected ref/SHA model
T1 push feature/probe, docs-only No No run evidence; preserve commit SHA
T2 push feature/probe, app/** Yes feature branch ref + pushed SHA
T3 pull_request feature → main, app/** Yes PR merge ref/SHA + separate head SHA
T4 workflow_dispatch scenario=smoke, dry_run=true Yes selected branch/ref; workflow must exist on default branch
T5 repository_dispatch academy_probe synthetic payload Yes default branch ref + latest default-branch SHA
T6 schedule 23 4 * * 1-5 Eligible at schedule latest default-branch commit; actual start may be delayed

4. Execute T1–T4 in controlled order

  1. T1: commit docs-only change on feature/probe. Record commit SHA and prove no new checkpoint run exists.
  2. T2: commit app/message.txt. Record run ID/attempt/ref/SHA and job conclusion.
  3. T3: open/update PR targeting main. Record merge ref/SHA plus PR_HEAD_SHA; explain why they differ.
  4. Merge workflow definition to main before T4/T5. This satisfies current dispatch default-branch presence rules.
  5. T4: manually dispatch with smoke/true; record selected ref, input values, run ID/attempt.

Do not combine T1 and T2 in one commit. The checkpoint is designed to isolate path filtering as the only material variable.

5. Execute optional authenticated T5 safely

Confirm the target before making the request:

export GH_REPO='OWNER/chapter03-trigger-lab'
printf 'dispatch target=%s\n' "$GH_REPO"
gh repo view "$GH_REPO" --json nameWithOwner,defaultBranchRef

Then create the custom event:

gh api --method POST "repos/$GH_REPO/dispatches" \
  -f event_type='academy_probe' \
  -f 'client_payload[source]=chapter03-checkpoint' \
  -F 'client_payload[dry_run]=true'

Record the API success response/status, resulting run ID, event name, payload fields, default-branch ref, and SHA. If your environment has no authenticated GitHub CLI, document T5 as a faithful request/response simulation instead; the chapter remains complete without exposing a token.

6. T6 schedule verification without waiting

Verify the workflow on main, record the exact cron/timezone, and predict that a scheduled run uses the latest default-branch commit. Record the limitation that current GitHub schedules may be delayed and are not a hard real-time guarantee. If a naturally occurring scheduled run happens during the lab window, capture its actual start timestamp and compare it with the configured schedule; otherwise do not manufacture a run.

7. Reconciliation table

ID Predicted Observed Evidence Conclusion
T1 No run Fill in commit SHA + run-history absence Filter matched/not matched?
T2 Run Fill in run ID/attempt/ref/SHA/log Push contract verified?
T3 Run Fill in merge ref/SHA + head SHA PR revision model verified?
T4 Run Fill in inputs + selected ref + run ID Manual contract verified?
T5 Run/simulation Fill in API + payload + default ref/SHA Custom event contract verified?
T6 Schedule eligibility Fill in workflow text + optional real run Timing limitation documented?

8. Required evidence packet

  • Repository name/default branch and checkpoint workflow path/hash.
  • Prediction matrix completed before execution.
  • For every created run: event name/action, actor, ref/SHA, workflow ref, run ID/attempt, runner label, final job conclusion.
  • For T3: base/head refs, PR merge SHA, PR head SHA, explanation of intended CI question.
  • For T4: input definitions and actual typed input values.
  • For T5: event type, synthetic payload, API status or simulation note, default-branch ref/SHA.
  • For T1: negative evidence proving a matching branch with a nonmatching path created no run.
  • For T6: cron/timezone, default-branch rule, five-minute minimum, schedule-delay limitation.
  • Assumptions/limitations: no secrets, artifacts, caches, environment approvals, OIDC, cloud deployment, self-hosted runner, or third-party action.

9. Verification checklist

  • Chapter 03 workflow exists on default branch before manual/custom dispatch testing.
  • Both branch and path filters are interpreted with AND semantics.
  • PR evidence distinguishes merge SHA from head SHA.
  • No whole-context dump or direct untrusted expression interpolation appears.
  • permissions: {} is sufficient because the workflow only reads context/environment and writes logs.
  • Repository dispatch targets only the explicitly named disposable repository.
  • Schedule is documented as approximate and default-branch based.
  • Negative “no run” evidence is retained rather than hidden.

10. Cleanup / rollback

  1. Close the disposable PR if it remains open.
  2. Keep run IDs/attempts and the checkpoint packet until review is complete.
  3. Delete only the learner-owned disposable branch/repository if no longer needed.
  4. Do not delete surprising runs merely to produce an all-green history.
  5. No cloud, registry, package, runner registration, or production resource rollback is required.

11. What Chapter 03 adds to the operating model

Chapter 03 adds the trigger contract: event identity/activity, branch/path/type filters, event-specific ref/SHA semantics, workflow revision selection, default-branch eligibility rules, manual/custom dispatch input contracts, schedule assumptions, and explicit differentiation between “no run,” “run with skipped job,” and “run with failed job.”

Chapter 04 builds directly on this: once a run exists, contexts and expressions determine conditional behavior and data selection inside that run.

Next lesson

Contexts, Expressions, Functions, Conditionals, and Evaluation Semantics

The event is now predictable. Next, learn exactly how workflow expressions read event/runtime data and decide which jobs and steps execute.

Knowledge check

Why is T1 “no run” evidence part of the checkpoint packet?

What two SHAs must T3 preserve?

Why must the workflow be present on main before T4/T5?

What does T5 prove if the payload says dry_run=true?

If T6 starts several minutes late, is the checkpoint automatically failed?

Official references and version notes

Version and compatibility note

Version-sensitive trigger behavior was rechecked against current primary GitHub documentation on 2026-09-09. Executable labs use a disposable repository, ubuntu-24.04, built-in shell steps only, and explicit permissions: {} because no repository API mutation is required from inside the workflow. At verification time, workflow_dispatch, repository_dispatch, and schedule require the workflow file to exist on the default branch; scheduled workflows run from the latest default-branch commit, support POSIX cron plus an optional IANA timezone, and have a minimum five-minute interval but may be delayed under load. GitHub is continuously delivered, so event payload fields, limits, schedule behavior, and default-branch rules must be rechecked before long-lived production use. The checkpoint requires no paid/enterprise/cloud feature. The optional repository_dispatch execution requires an authenticated caller with appropriate repository permission; a faithful request/response simulation is the no-credential fallback.

Keep the academy open

Support free, practical DevOps education.

Every lesson is designed to remain readable in a browser, downloadable from GitHub, and usable without a paid learning platform. Contributions help expand and maintain the curriculum.

Ethereum / ERC-20
0x716c4Ab160C4B66F31a28AE2448BfF68fc3a2ef0Send only Ethereum/ERC-20 compatible assets to this address.