Trigger a workflow from another workflow in GitHub Actions
Start one GitHub Actions workflow from another: workflow_call, workflow_dispatch with gh, workflow_run, repository_dispatch, and the GITHUB_TOKEN rule.
In this series26 guides, you're on Triggering other workflows
There are four ways to start one workflow from another, and the right one depends on whether the other workflow’s jobs should run inside this run or as a separate run, and whether the other workflow lives in the same repository:
| You want to… | Use | Token |
|---|---|---|
| Run another workflow’s jobs inside this run, and wait for them | A reusable workflow (workflow_call) | Inherited, nothing to set up |
| Start a workflow in the same repository, as a separate run | workflow_dispatch (or repository_dispatch) | GITHUB_TOKEN with actions: write (contents: write for repository_dispatch) |
| Run a workflow after another one finishes | workflow_run | None, it’s a trigger |
| Start a workflow in another repository | workflow_dispatch or repository_dispatch | GitHub App token (or a PAT) |
A common belief is that GITHUB_TOKEN can never start another workflow. That’s true for most events: a push made with GITHUB_TOKEN doesn’t trigger on: push workflows, which prevents runaway loops. But workflow_dispatch and repository_dispatch are exceptions: they always create a workflow run ↗, even when sent with GITHUB_TOKEN. Since June 2026, a pull request opened or updated with GITHUB_TOKEN also starts pull_request runs, but they wait until someone with write access clicks Approve workflows to run. Use a GitHub App token if bot pull requests must run CI on their own. Otherwise, you only need another identity when you cross a repository boundary.
Same repository: workflow_dispatch with GITHUB_TOKEN#
The target workflow needs a workflow_dispatch trigger that declares each input the caller passes. Here is the trigger of a deploy.yml whose jobs read ${{ inputs.environment }} (input types are covered in Triggers):
on: workflow_dispatch: inputs: environment: type: choice options: [staging, production]The calling workflow dispatches it with the gh CLI, which is installed on GitHub-hosted runners and on RunsOn’s default full images, but not on its minimal images. The job needs actions: write to dispatch:
name: CI
on: push: branches: [main]
jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 - run: make test
trigger-deploy: needs: test runs-on: ubuntu-latest permissions: actions: write steps: - run: gh workflow run deploy.yml --ref main -f environment=staging env: GH_TOKEN: ${{ github.token }} GH_REPO: ${{ github.repository }}gh workflow run returns as soon as the dispatch is accepted. The deploy shows up as a separate run in the Actions tab, so the CI run doesn’t wait for it and doesn’t fail if it fails.
The deploy runs on whatever main points to when the dispatch lands. If someone pushed to main after this CI run started, that’s a newer commit that this run’s test job never tested. A dispatch takes a branch or tag, not a commit SHA, so to deploy exactly the tested commit, add a sha input to deploy.yml, pass -f sha="$GITHUB_SHA" when you dispatch, and check that commit out in the deploy with ref: ${{ inputs.sha }} on actions/checkout. A reusable workflow doesn’t need this: it runs at the caller’s commit.
Since February 2026, gh workflow run prints the URL of the run it creates (gh 2.87.0 or later). To make CI wait for the deploy and fail if it fails, replace the step in the trigger-deploy job with one that watches that run:
- run: | url=$(gh workflow run deploy.yml --ref main -f environment=staging) gh run watch "${url##*/}" --exit-status --interval 30 env: GH_TOKEN: ${{ github.token }} GH_REPO: ${{ github.repository }}${url##*/} is the run ID, the last part of the URL. gh run watch checks the run every 3 seconds by default, a rate of several thousand API requests an hour, above GITHUB_TOKEN’s limit of 1,000 requests per hour per repository. --interval 30 cuts it to a few hundred an hour. Add checks: read to the job’s permissions too, so that gh can show the deploy’s annotations; without it, each refresh logs a harmless requesting annotations returned 403 Forbidden note. For a run in another repository, add --repo my-org/triggered-repo to both commands and use a GitHub App token.
The watching job keeps its runner busy until the deploy finishes, and you pay for that time as for any other job. A job that calls a reusable workflow has no runner of its own.
Reusable workflows: workflow_call#
When you want the other workflow’s jobs inside this run, with outputs that later jobs can read, call it as a reusable workflow ↗ instead of dispatching it. The called workflow declares workflow_call:
name: Build
on: workflow_call: inputs: target: type: string required: true outputs: image: value: ${{ jobs.build.outputs.image }}
jobs: build: runs-on: ubuntu-latest outputs: image: ${{ steps.build.outputs.image }} steps: - uses: actions/checkout@v7 - id: build env: TARGET: ${{ inputs.target }} run: echo "image=my-app:$TARGET-$GITHUB_SHA" >> "$GITHUB_OUTPUT"The caller uses it as a job, with uses: at the job level instead of runs-on::
jobs: build: uses: ./.github/workflows/build.yml with: target: linux secrets: inherit
deploy: needs: build runs-on: ubuntu-latest steps: - run: echo "Deploying $IMAGE" env: IMAGE: ${{ needs.build.outputs.image }}The called workflow can live in another repository too (uses: my-org/shared-workflows/.github/workflows/build.yml@v1), as long as that repository allows access. workflow_dispatch vs workflow_call: dispatch starts a separate, independent run; call runs the jobs inside the current run, with shared outputs, needs and status. To deploy from a called workflow, put environment: on its job, not on the calling job: see environments in reusable workflows.
After another workflow: workflow_run#
workflow_run starts a workflow when another one completes. It’s useful for a privileged follow-up (posting a comment, publishing a report) after an unprivileged CI run:
name: Report
on: workflow_run: workflows: [CI] types: [completed]
jobs: report: if: github.event.workflow_run.conclusion == 'success' runs-on: ubuntu-latest # Grant only what the follow-up needs. permissions: {} steps: - run: echo "CI passed on $HEAD_BRANCH" env: HEAD_BRANCH: ${{ github.event.workflow_run.head_branch }}workflow_run always runs the workflow file from the default branch, with access to secrets. If the CI run came from a fork, treat anything it uploaded as untrusted data: never execute an artifact downloaded from it. Treat the triggering run’s fields (branch name, commit message, pull request title) as untrusted too: pass them through env:, never ${{ }} inside run:. The pull_request vs pull_request_target guide explains the same risk for pull_request_target.
Without a ref, actions/checkout in this workflow gets the default branch’s latest commit, which isn’t necessarily the commit CI tested. To use what CI built, download its artifacts with run-id: ${{ github.event.workflow_run.id }} and github-token, as in the safe pattern. workflow_run chains also stop after three levels: in A → B → C → D → E, where each workflow runs when the one before it completes, E never runs.
Another repository: a GitHub App token#
GITHUB_TOKEN is scoped to the repository running the workflow, so it can’t dispatch into another one. Use a GitHub App token, which is short-lived (about an hour), scoped to the repositories you choose, and not tied to a person, unlike a personal access token.
- Create a GitHub App in your organization settings, with the Actions: Read and write repository permission (dispatching
repository_dispatchneeds Contents: Read and write instead). - Generate a private key and note the app’s Client ID, shown on its settings page. It is not the App ID.
- Install the app on the repository that owns the triggered workflow.
- In the calling repository, store the Client ID as a variable,
APP_CLIENT_ID, and the private key as a secret,APP_PRIVATE_KEY.
Then mint a token and dispatch:
name: Release
on: push: tags: ["v*"]
jobs: trigger: runs-on: ubuntu-latest steps: - name: Generate GitHub App token id: app-token uses: actions/create-github-app-token@v3 with: client-id: ${{ vars.APP_CLIENT_ID }} private-key: ${{ secrets.APP_PRIVATE_KEY }} # By default the token only covers the current repository. owner: my-org repositories: triggered-repo
- name: Trigger the deploy workflow in another repository run: gh workflow run deploy.yml --repo my-org/triggered-repo --ref main -f environment=production env: GH_TOKEN: ${{ steps.app-token.outputs.token }}As of November 2026, the latest actionlint (1.7.12) doesn’t know client-id yet: it reports it as an unknown input, and app-id as a missing one. The example is correct, so ignore those two errors, for example with -ignore 'input "(app-id|client-id)"'.
The benc-uk/workflow-dispatch ↗ action does the same thing as the gh workflow run line if you prefer an action, and it can wait for the dispatched run to finish. Across repositories it needs repo and token, and here ref too: it defaults to the caller’s ref, which in this Release workflow is a tag of the calling repository. It takes inputs as a JSON string. In place of the gh step:
- name: Trigger the deploy workflow and wait for it uses: benc-uk/workflow-dispatch@v1 with: workflow: deploy.yml repo: my-org/triggered-repo ref: main token: ${{ steps.app-token.outputs.token }} inputs: '{"environment": "production"}' wait-for-completion: true wait-timeout-seconds: 3600 # default 900 sync-status: true # fail this step if the run fails or is cancelledWithout sync-status: true, the step passes whatever the run’s result. Even with it, only a failure or cancelled conclusion fails the step. When wait-timeout-seconds runs out, the action logs a warning and stops waiting, and the step passes while the run goes on, so set the timeout above your longest deploy.
For repository_dispatch, the target workflow declares on: repository_dispatch: types: [deploy], and you send the event with gh api repos/my-org/triggered-repo/dispatches -f event_type=deploy. To send data with it, add client_payload fields, such as -f 'client_payload[environment]=production': the target reads that as github.event.client_payload.environment (pass it to a run: step through env:), and client_payload takes at most 10 top-level keys. Unlike workflow_dispatch, there’s no ref to choose: the run always uses the default branch’s workflow file and latest commit. It’s handy when the sender isn’t a workflow at all (another CI system, a webhook), since it doesn’t need to know the workflow file name.
Things that trip people up#
- The target workflow must exist on the default branch for
workflow_dispatchto be accepted, even if you dispatch it on another--ref. - Missing
actions: write. With restrictive default token permissions,gh workflow runfails withHTTP 403: Resource not accessible by integration. Add the permission to the dispatching job. - Read inputs from the
inputscontext.github.event.inputsholds every value as a string ("true", nottrue); theinputscontext keeps booleans and numbers typed. - Runs started by a workflow still count as separate runs for concurrency groups and billing. Pair them with a concurrency group if two dispatches must not overlap. By default, a newer dispatch replaces one that is still pending, so in a burst of three the middle one never runs: add
queue: maxwhen every dispatch must run. - A reusable workflow doesn’t see the caller’s workflow-level
env. Pass those values as inputs. A called workflow also can’t get moreGITHUB_TOKENpermissions than the calling job grants. Inside it,github.workflowis the caller’s name, so a concurrency group built from it can cancel the caller. On GitHub.com, reusable workflows nest up to nine levels below the top-level caller, and one workflow file can call at most 50 unique reusable workflows, nested ones included.