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
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
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.
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.
Bahasa Melayu
Empat larian, empat cara bermula. Satu push. Satu pull request. Satu jam. Satu butang. Macam mana robot tahu bila nak bangun?
Setiap permulaan ialah satu event (peristiwa). push berlaku bila commit sampai. branches: [main] hadkan kepada main. pull_request berlaku bila PR dibuka atau berubah.
schedule ialah jam loceng. Ia guna cron: minit, jam, hari, bulan, hari minggu. Secara lalai, masa dalam UTC. Bila cron: '30 1 * * 1' berbunyi?
workflow_dispatch beri anda butang Run workflow di GitHub. Tekan bila-bila masa. GitHub CLI pun boleh tekan untuk anda, macam di atas.
Trigger mana sesuai untuk setiap tugas? Susun.
Workflow malam anda ada pada branch lain. Ia belum ada di main. Adakah loceng akan berbunyi?
Adakah setiap trigger sesuai dengan matlamat? Leret setiap satu.
Kini anda boleh pilih bila workflow berjalan.
You finished this before. Practice is always welcome!
Official docs: Events that trigger workflows ยท Workflow syntax: on
You've learned for 25 minutes. A short break helps your brain.
Sprint done! Great focus. Stretch for a minute?