Skip to content

Trigger Rollout Workflow

Actions
Triggers a workflow in the rollout repository using GitHub API dispatches
v1.1.0
Latest
Star (0)

Trigger Rollout Workflow

A GitHub Action that triggers workflows in rollout repositories using GitHub API repository dispatch events.

What it does

This action provides a seamless way to trigger rollout workflows in target repositories by sending repository dispatch events with structured payloads containing service deployment information.

Features

  • Repository Dispatch: Triggers workflows using GitHub's repository dispatch API
  • 🔄 Flexible Configuration: Configurable event types and target repositories
  • 📦 Rich Metadata: Includes workflow context, commit information, and custom metadata
  • 🔒 Secure: Uses GitHub tokens with appropriate repository permissions
  • 🎯 Service-Oriented: Designed for microservice deployment workflows

Inputs

Input Description Required Default
github-token GitHub token with repo permissions for rollout repository -
event-type Event type for the repository dispatch add-rollout
target-repo-owner Owner of the repository to trigger the dispatch in -
target-repo-name Name of the repository to trigger the dispatch in -
service-name Name of the service to rollout -
namespace Kubernetes namespace for the service -
committer-email Email of the person or system triggering the rollout github-actions@github.com
committer-name Name of the person or system triggering the rollout GitHub Actions
requester Identifier for the requester of the rollout github-actions
commit-sha Commit SHA to include in the rollout metadata Current commit SHA

All dependencies auto-install if missing.

Outputs

Output Description
success Whether the dispatch was successful
response-status HTTP response status from the API call
dispatch-id Unique ID for this dispatch event

Usage

Basic Example

- name: Trigger Rollout
  uses: tylerdgenius/trigger-repo-event@v1
  with:
    github-token: ${{ secrets.ROLLOUT_REPO_TOKEN }}
    target-repo-owner: 'your-org'
    target-repo-name: 'rollout-repo'
    service-name: 'my-service'
    namespace: 'production'

Advanced Example with Custom Configuration

- name: Trigger Custom Rollout
  uses: tylerdgenius/trigger-repo-event@v1
  with:
    github-token: ${{ secrets.ROLLOUT_REPO_TOKEN }}
    event-type: 'custom-deployment'
    target-repo-owner: 'your-org'
    target-repo-name: 'deployment-automation'
    service-name: 'backend-api'
    namespace: 'staging'
    committer-name: ${{ github.actor }}
    committer-email: '${{ github.actor }}@users.noreply.github.com'
    requester: 'ci-pipeline'
    commit-sha: ${{ github.sha }}

Repository Dispatch Payload

The action sends a repository dispatch event with the following payload structure:

{
  "event_type": "add-rollout",
  "client_payload": {
    "namespace": "production",
    "requester": "github-actions",
    "service_name": "my-service",
    "committer_name": "GitHub Actions",
    "committer_email": "github-actions@github.com",
    "metadata": {
      "workflow_run_id": 12345,
      "repository": "your-org/source-repo",
      "commit": "abc123...",
      "ref": "refs/heads/main",
      "actor": "username",
      "timestamp": "2023-09-21T10:30:00.000Z",
      "dispatch_id": "1695292200000-xyz789abc",
      "workflow_run_number": 42
    }
  }
}

Target Repository Setup

The target repository should have a workflow that responds to the repository dispatch event:

name: Handle Rollout Request
on:
  repository_dispatch:
    types: [add-rollout]
jobs:
  process-rollout:
    runs-on: ubuntu-latest
    steps:
      - name: Process rollout
        run: |
          echo "Service: ${{ github.event.client_payload.service_name }}"
          echo "Namespace: ${{ github.event.client_payload.namespace }}"
          echo "Requester: ${{ github.event.client_payload.requester }}"
          echo "Dispatch ID: ${{ github.event.client_payload.metadata.dispatch_id }}"

Required Permissions

The GitHub token used must have the following permissions on the target repository:

  • Contents: Read
  • Metadata: Read
  • Actions: Write (for repository dispatch)

Error Handling

The action will fail gracefully and set outputs accordingly:

  • On success: success=true, response-status=204, dispatch-id=<unique-id>
  • On failure: success=false, response-status=0, dispatch-id="", and detailed error message

License

MIT

Trigger Rollout Workflow is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

About

Triggers a workflow in the rollout repository using GitHub API dispatches
v1.1.0
Latest

Trigger Rollout Workflow is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.