Actions
Actions are buttons that start a GitHub Actions workflow. Use them to deploy the site, rebuild a page, optimize images or anything else you've automated. Your workflow does the work; Pages CMS starts it, passes it context and tracks the run.
Add a deploy button
1. Create the workflow. It must accept a payload input:
name: Deploy
on:
workflow_dispatch:
inputs:
payload:
description: Pages CMS context as JSON
required: true
type: string
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: echo "Run your deploy command here"2. Add the button to .pages.yml:
actions:
- name: deploy
label: Deploy site
workflow: deploy.yml3. Try it. Choose Deploy site in the sidebar, confirm, and watch the run in Actions.
Where buttons appear
Where you define an action decides where its button shows up and what it acts on:
For example, add this action to a collection in .pages.yml to show a button on each entry:
content:
- name: posts
type: collection
path: content/posts
actions:
- name: preview
label: Preview
workflow: preview.yml
scope: entryKeys
Ask for inputs
fields adds a form to the confirmation dialog. Values arrive in payload.inputs.
actions:
- name: deploy
label: Deploy
workflow: deploy.yml
fields:
- name: environment
label: Environment
type: select
required: true
default: staging
options:
- { label: Staging, value: staging }
- { label: Production, value: production }
- name: clear_cache
label: Clear CDN cache
type: checkboxWhen an action has fields, the dialog is shown even with confirm: false.
The payload
Your workflow receives one JSON string in inputs.payload:
{
"source": "pages-cms",
"action": { "name": "deploy", "label": "Deploy", "cancelable": true },
"repository": {
"owner": "acme",
"repo": "website",
"ref": "main",
"workflowRef": "main",
"sha": "abc123…"
},
"triggeredAt": "2026-03-30T12:00:00.000Z",
"triggeredBy": {
"userId": "…",
"name": "Sam Lee",
"email": "sam@example.com",
"githubUsername": "samlee"
},
"context": {
"type": "entry",
"name": "posts",
"path": "content/posts/hello.md"
},
"inputs": { "environment": "staging", "clear_cache": true }
}context describes where the action was run from: the repository, a collection, an entry, a file or a media library. Reruns also include "triggerType": "rerun" and rerunOfActionRunId. Read values with fromJSON:
- run: ./deploy.sh "$ENVIRONMENT"
env:
ENVIRONMENT: ${{ fromJSON(inputs.payload).inputs.environment }}Treat the entire payload as user input, including filenames, form values, and the triggering user’s name. In a shell step, pass expressions through env and quote the shell variable as shown above. GitHub substitutes expressions placed directly in run before the shell executes the script.
Who can run actions
Managers can run, cancel and rerun actions. Collaborators can't, unless they're on a hosted Pro project and their role grants it; even then they can cancel only their own runs.
GitHub Actions must be enabled on the repository.