A workflow file in GitHub Actions is a YAML file that defines a set of jobs and steps to automate tasks. These files are stored in the .github/workflows
directory of your repository.
Basic Structure
name: <workflow-name>
on:
- <event-type>
jobs:
<job-id>:
runs-on: <os-type>
steps:
- <action-or-script>
🛠️ Use on
to trigger workflows (e.g., push
, pull_request
).
💡 runs-on
specifies the environment (e.g., ubuntu-latest
).
Common Keywords
Keyword | Description |
---|---|
name |
Workflow name (required) |
jobs |
List of jobs (required) |
steps |
Individual tasks within a job |
env |
Environment variables |
Example
📄 View a sample workflow file to see how to define a CI/CD pipeline.
For deeper understanding, check our guide on GitHub Actions basics. 🚀