.github/workflows/ |
Directory to store GitHub Actions workflows. |
on: |
Specify events that trigger the workflow. |
name: |
Assign a name to the workflow. |
jobs: |
Define one or more jobs in the workflow. |
runs-on: |
Specify the runner for the job (e.g., ubuntu-latest). |
steps: |
Define a sequence of steps within a job. |
uses: |
Use an action from the GitHub Marketplace or another repository. |
with: |
Set input parameters for an action. |
env: |
Define environment variables for the job. |
if: |
Conditionally execute a step or job based on an expression. |
jobs.<job_id>.outputs.<output_name> |
Reference outputs from one job in another. |
jobs.<job_id>.needs |
Specify jobs that must complete successfully before the current job runs. |
jobs.<job_id>.strategy |
Define a matrix of values for a job matrix build. |
workflow_run |
Trigger a workflow based on another workflow's completion. |
github.event |
Access information about the event that triggered the workflow. |
github.repository |
Access information about the repository where the workflow is running. |
github.sha |
Access the commit SHA that triggered the workflow. |
github.token |
Access a token to authenticate with GitHub. |
jobs.<job_id>.steps.<step_id>.continue-on-error |
Continue with the next step even if the current step fails. |
jobs.<job_id>.container |
Define a Docker container to run the job in. |
env: |
Set environment variables for the entire workflow. |
jobs.<job_id>.outputs |
Define outputs for a job. |
jobs.<job_id>.timeout-minutes |
Set a maximum execution time for a job. |
jobs.<job_id>.runs-on: |
Specify a different runner for a specific job. |
on: push |
Trigger the workflow on push events. |
on: pull_request |
Trigger the workflow on pull request events. |
workflow_dispatch : |
Manually trigger the workflow using the GitHub Actions UI. |
workflow_run: |
Trigger a workflow based on another workflow's completion. |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' |
Example conditional execution based on event and branch. |
jobs.<job_id>.continue-on-error: ${{ needs.<dependency>.result }} |
Continue with the next job even if the dependency job fails. |
jobs.<job_id>.steps.<step_id>.with |
Set input parameters for a specific step. |
jobs.<job_id>.runs-on: ${{ matrix.os }} |
Example matrix build for different operating systems. |
jobs.<job_id>.strategy.matrix |
Define a matrix of values for a job matrix build. |