Sikau

GitHub Actions · Day 2 · about 30 min

Triggers

push, pull_request, branch and path filters, manual and scheduled runs.

Run at the right moments

Running everything on every push wastes minutes and money. Filters say exactly when: only pushes to main, every pull request into main, skip docs-only changes, plus a Run button and a nightly schedule.

Filtering events

name: CI

on:
  push:
    branches: [main]
    paths-ignore:
      - "docs/**"
      - "**.md"
  pull_request:
    branches: [main]
  workflow_dispatch:
  schedule:
    - cron: "0 3 * * *"

jobs:
  check:
    runs-on: ubuntu-latest
    steps:
      - run: echo "event=${{ github.event_name }} ref=${{ github.ref }}"

The rest of this lesson

  • push versus pull_requestexplain
  • Path filtersexplain
  • Does it run?predict
  • Pick the triggermatch
  • Your turnwrite code
  • Badge quizquiz
  • What you learnedrecap

Continue this lesson free — run real code in your browser

Continue with Google

See all 12 lessons of GitHub Actions