Workflow Syntax
On
on:
# Triggered manually (run button)
workflow_dispatch:
# Triggered on pull request
pull_request:
# Triggered on push on specified branch
push:
branchs:
- my-branch
# Triggered by another workflow
workflow_run:
workflows:
- myWorkflow
Checkout
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: recursive # Fetch repo submodules
lfs: true # Fetch LFS data
Variables
github
User
github.actor: name of the use the triggered the workflow.
Ref
github.ref_name: branch name (warning: don't work in PR triggered workflow seegithub.head_ref).github.head_ref: PR source branch name.github.head_ref: PR target branch name.
GitHub CLI
Workflow
gh workflow run my-test-workflow.yml \--ref my-test-branch \--field my_input_1=12 \--field my_input_2=blaRun a workflow that doesn't exist on the default branch yes (needs to have
on: push: branchsset).
