Dispatch GitHub Actions Workflow

Action ID: github:actions:dispatch
NPM Package:

@backstage/plugin-scaffolder-backend-module-github

Description

Dispatches a GitHub Action workflow for a given branch or tag

Input Schema

PropertyTypeDescriptionRequired
tokenstringThe `GITHUB_TOKEN` to use for authorization to GitHub
repoUrlstringAccepts the format `github.com?repo=reponame&owner=owner` where `reponame` is the new repository name and `owner` is an organization or username
workflowIdstringThe GitHub Action Workflow filename
workflowInputsobjectInputs keys and values to send to GitHub Action configured on the workflow file. The maximum number of properties is 10.
branchOrTagNamestringThe git branch or tag name used to dispatch the workflow

Output Schema

No output schema defined for this action.

Usage Examples

Trigger CI on main after scaffolding

Runs the repository CI workflow on the main branch right after content is prepared. Use this when your workflow needs parameters like Node version or lint toggle. The example fetches files with fetch:template then dispatches the workflow.

Copy
steps:
  - id: fetch
    action: fetch:template
    input:
      url: ./skeleton
      values:
        name: ${{ parameters.repoName }}
        owner: ${{ parameters.owner }}

  - id: trigger-ci
    action: github:actions:dispatch
    input:
      repoUrl: github.com?owner=${{ parameters.owner }}&repo=${{ parameters.repoName }}
      workflowId: ci.yml
      branchOrTagName: main
      workflowInputs:
        node_version: 20
        run_lint: true
      token: ${{ secrets.githubToken }}

Dispatch a release workflow for a specific tag

Dispatches a release workflow using a tag provided at template execution time. Use this when a tag already exists and your workflow expects release inputs.

Copy
steps:
  - id: trigger-release
    action: github:actions:dispatch
    input:
      repoUrl: github.com?owner=${{ parameters.owner }}&repo=${{ parameters.repoName }}
      workflowId: release.yml
      branchOrTagName: ${{ parameters.releaseTag }}
      workflowInputs:
        release_name: ${{ parameters.releaseTag }}
        generate_changelog: true
        prerelease: false
      token: ${{ secrets.githubToken }}

Run integration tests on a feature branch

Starts a workflow on a feature branch with environment specific inputs. Use this to validate changes before opening a pull request. Content is prepared with fetch:template.

Copy
steps:
  - id: fetch
    action: fetch:template
    input:
      url: ./service-template
      values:
        serviceId: ${{ parameters.serviceId }}
        owner: ${{ parameters.owner }}

  - id: trigger-tests
    action: github:actions:dispatch
    input:
      repoUrl: github.com?owner=${{ parameters.owner }}&repo=${{ parameters.repoName }}
      workflowId: tests.yml
      branchOrTagName: feature/${{ parameters.featureName }}
      workflowInputs:
        test_suite: integration
        environment: staging
        enable_cache: false
        timeout_minutes: 30

Kick off an infra plan in a separate repository

Dispatches a Terraform plan workflow in a dedicated infrastructure repository. Use this to coordinate application scaffolding with an infra plan for a specific environment.

Copy
steps:
  - id: plan-infra
    action: github:actions:dispatch
    input:
      repoUrl: github.com?owner=acme-corp&repo=platform-infra
      workflowId: terraform-plan.yml
      branchOrTagName: main
      workflowInputs:
        service: ${{ parameters.serviceId }}
        environment: prod
        plan_only: true
        terraform_version: 1.6.6
      token: ${{ secrets.githubToken }}

Trigger a release candidate pipeline without additional inputs

Dispatches a workflow using a release candidate tag with no extra inputs. Use this when the workflow has only required GitHub inputs. This example relies on the GitHub integration token.

Copy
steps:
  - id: trigger-rc
    action: github:actions:dispatch
    input:
      repoUrl: github.com?owner=octo-org&repo=payment-service
      workflowId: build-and-release.yml
      branchOrTagName: v2.0.0-rc.1