World map

 

BM: Baca dalam Bahasa Melayu

World 7: Robots: Actions & CI/CD

Triggers: push, PR, schedule, manual

You will learn: how to choose when a workflow runs.

The problem

Practice repo โ€” not a real website
aina-codes / diary

Four runs, four ways to start. A push. A pull request. A clock. A button. How does the robot know when to wake up?

Watch

Tap the line that checks pull requests.

0 of 1 found

Each start is an trigger (event): What wakes a workflow up, like a push, a pull request or a clock.. push fires when commits land. branches: [main] keeps it to main. pull_request fires when a PR opens or changes.

Watch

schedule is an alarm clock. It uses cron: A short time code: minute, hour, day, month, weekday. Example: 30 1 * * 1.: minute, hour, day, month, weekday. By default, times are in UTC. When does cron: '30 1 * * 1' ring?

Pick one answer.

Watch

bash
gh workflow run deploy.yml
The GitHub CLI command gh workflow run deploy.yml starts the Deploy workflow by hand.

workflow_dispatch gives you a Run workflow button on GitHub. Press it any time. The GitHub CLI can press it for you, like above.

Try it

Which trigger fits each job? Sort them.

Drag a card into a box. Or tap the card, then tap the box.

        Predict

        Your nightly workflow sits on a feature branch. It is not on main yet. Will the alarm ring?

        Pick one answer.

        Check

        Does each trigger fit the goal? Swipe each one.

        Swipe right for good, left for needs work. Or use the buttons.

        1 / 4

        Test every PR: on: pull_request

        Test every PR: `on: pull_request`

        You did it!

        You can now choose when a workflow runs.

        Go deeper (optional)

        paths: runs a workflow only when certain files change. types: [opened] narrows pull_request to new PRs only. Busy times can delay scheduled runs. The top of the hour is busiest. So pick a minute like 30, not 0.