Git & GitHub
/Intermediate
Workflow Files
Definition
A configurable automated process that will run one or more jobs. Workflows are defined by a YAML file checked into your repository.
Explain Like I'm New
A workflow is the master blueprint you give to the GitHub Action robot. It dictates exactly WHEN the robot should wake up (the triggers), and WHAT it should do once it is awake (the jobs).
Real World Example
Having three distinct workflows: `test.yml` (runs on every PR to check for bugs), `deploy.yml` (runs only when code is merged to main, pushing it to AWS), and `cleanup.yml` (runs every Sunday at midnight to delete old cache files).
Common Use Cases
- •Defining CI/CD pipelines
Terminal Output
bash / terminal
name: Daily Greeting Robot
# TRIGGERS: Run manually via a button click, OR run every day at 9:00 AM UTC
on:
workflow_dispatch: # Adds a 'Run Workflow' button in the GitHub UI
schedule:
- cron: '0 9 * * *'
jobs:
say-hello:
runs-on: ubuntu-latest
steps:
- run: echo "Good morning! Another day, another bug to fix."
Interview Questions
basic
- In what exact folder must you place your workflow YAML files so GitHub can find them?
intermediate
- What is a `cron` trigger in a workflow?