Spec Version:

Automate Transformations Management with Rudder CLI and GitHub Actions Beta

Leverage GitHub Actions for automated validation, testing, and deployment of your RudderStack transformations.
Available Plans
  • free
  • growth
  • enterprise

This guide explains how to validate, test, and manage your RudderStack transformations directly via GitHub workflows using the Rudder CLI Project Manager Action.

Key features

By leveraging the Rudder CLI Project Manager Action, you can:

  • Validate: Check your transformation YAML configurations for syntax and structure.
  • Test: Execute transformation code against test events using the specialized transformations-test action.
  • Apply: Deploy your transformations and libraries to your RudderStack workspace automatically.

Prerequisites

ResourcePermissions
TransformationsEdit, Connect, Create & Delete
Transformation LibrariesEdit
  • If you’re on Free or self-hosted plan, or for testing and development only: Generate a Personal Access Token with Read-Write role
warning
Any action authenticated by a Personal Access Token will break if the user generating the token is removed from the organization or there is a breaking change to their permissions.

Token permissions for legacy RBAC system

If you are on the legacy Permissions Management (RBAC) system, your workspace-level Service Access Token should have the Admin role and Grant edit access toggled on under Transformations.

See Generate a workspace-level Service Access Token for steps to create the token.

workspace-level Service Access Token with Transformations Admin permission

Setup

Follow these steps to set up the GitHub Actions workflow for your transformations.

Step 1: Configure repository secrets

  1. In your GitHub repository, go to Settings > Secrets and variables > Actions.
  2. Add a new repository secret:
    • Name: RUDDERSTACK_ACCESS_TOKEN
    • Value: The access token generated in the Prerequisites section.
warning

RudderStack recommends storing this token in GitHub Secrets and referencing it in your workflow using ${{ secrets.RUDDERSTACK_ACCESS_TOKEN }}.

Do not expose the token directly in your workflow files.

Step 2: Create Actions workflow

Create the following workflow in .github/workflows/ within your repository, for example, .github/workflows/transformations.yml:

name: Manage Transformations

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]
    paths:
      - "project/transformations/**"

jobs:
  validate-and-test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Validate Project Files
        uses: rudderlabs/rudder-cli-action@v1.0.1
        env:
          RUDDERSTACK_ACCESS_TOKEN: ${{ secrets.RUDDERSTACK_ACCESS_TOKEN }}
        with:
          location: "project/"
          mode: "validate"

      - name: Test Modified Transformations
        uses: rudderlabs/rudder-cli-action/transformations-test@v1.0.1
        env:
          RUDDERSTACK_ACCESS_TOKEN: ${{ secrets.RUDDERSTACK_ACCESS_TOKEN }}
        with:
          location: "project/"
          scope: "modified"
          verbose: "true"

  apply:
    runs-on: ubuntu-latest
    needs: validate-and-test
    if: github.ref == 'refs/heads/main'
    steps:
      - uses: actions/checkout@v4
      - name: Apply Changes
        uses: rudderlabs/rudder-cli-action@v1.0.1
        env:
          RUDDERSTACK_ACCESS_TOKEN: ${{ secrets.RUDDERSTACK_ACCESS_TOKEN }}
        with:
          location: "project/"
          mode: "apply"

Action inputs

Main action (rudderlabs/rudder-cli-action)

Used for validate, dry-run, and apply modes.

InputDescriptionDefault
locationPath to the folder containing Rudder CLI project files.-
modeOperation mode: validate, dry-run, or apply.-
cli_versionVersion of the Rudder CLI tool to use.v0.13.1

Test action (rudderlabs/rudder-cli-action/transformations-test)

Specialized action for running transformation tests.

InputDescriptionDefault
locationPath to the folder containing Rudder CLI project files.-
scopeTest scope: all (all transformations) or modified (only changed ones).-
verboseShow detailed test output with diffs for failures.false
cli_versionVersion of the Rudder CLI tool to use.v0.13.1

How it works

  • Validation: The validate mode ensures your YAML files are correctly formatted before any further steps.
  • Testing: The transformations-test action runs your transformation code against the defined test cases. Using scope: modified in PRs is recommended for faster feedback.
  • Deployment: When changes are merged into the main branch, the apply mode pushes the updates to your RudderStack workspace.

Questions? We're here to help.

Join the RudderStack Slack community or email us for support