Flowzone

Reusable, opinionated, zero-conf workflows for GitHub actions
Contents
Getting Started
Open a PR with the following changes to test and enable Flowzone:
- Create
.github/workflows/flowzone.yml(see Usage) in a new Draft Pull Request to avoid changing branch protection rules. - Ensure your
package.json,docker-compose.test.yml,balena.yml, etc. contain correct information and all tests are passing. - Mark the Pull Request as Ready for Review and re-run the checks via the Checks or Actions panel. New branch protection rules will be applied and this requires admin access to revert!
- Seek approval or self-certify!
Usage
name: Flowzone
on:
# Internal and fork PRs both run here; forks run with no secrets.
pull_request:
types: [opened, synchronize, closed]
branches: [main, master]
# Fork contributions are rebuilt and published from the push to the default
# branch after merge.
push:
branches: [main, master]
jobs:
flowzone:
name: Flowzone
uses: product-os/flowzone/.github/workflows/flowzone.yml@master
# Workflows in the same org or enterprise can use the inherit keyword to implicitly pass secrets
secrets: inherit
# Otherwise you must manually specify which secrets to pass
secrets:
# GitHub App private key to generate ephemeral access tokens. Supports base64 encoded or raw
# PEM formats. If set, takes precedence over FLOWZONE_TOKEN.
# Required: false
FLOWZONE_APP_PRIVATE_KEY:
# Deprecated, use FLOWZONE_APP_PRIVATE_KEY instead
# Required: false
GH_APP_PRIVATE_KEY:
# .. or Personal Access Token (PAT) with admin/owner permissions in the org.
# Required: false
FLOWZONE_TOKEN:
# The NPM auth. token to use for publishing
# Required: false
NPM_TOKEN:
# Username to publish to the Docker Hub container registry
# Required: false
DOCKERHUB_USER:
# Deprecated, use DOCKERHUB_USER instead
# Required: false
DOCKER_REGISTRY_USER:
# A personal access token to publish to the Docker Hub container registry
# Required: false
DOCKERHUB_TOKEN:
# Deprecated, use DOCKERHUB_TOKEN instead
# Required: false
DOCKER_REGISTRY_PASS:
# API key for pushing releases to balena applications
# Required: false
BALENA_API_KEY:
# Deprecated, use BALENA_API_KEY instead
# Required: false
BALENA_API_KEY_PUSH:
# A personal access token to publish to a cargo registry
# Required: false
CARGO_REGISTRY_TOKEN:
# Optional base64 encoded docker-compose `.env` file for testing Docker images
# Required: false
COMPOSE_VARS:
# Cloudflare account ID
# Required: false
CF_ACCOUNT_ID:
# Cloudflare API token with limited access for Pages projects
# Required: false
CF_API_TOKEN:
# Token to publish to pypi.org
# Required: false
PYPI_TOKEN:
# Token to publish to test.pypi.org
# Required: false
PYPI_TEST_TOKEN:
# API key to post Zulip messages.
# Required: false
ZULIP_API_KEY:
# Optional secret for using with custom jobs
# Required: false
CUSTOM_JOB_SECRET_1:
# Optional secret for using with custom jobs
# Required: false
CUSTOM_JOB_SECRET_2:
# Optional secret for using with custom jobs
# Required: false
CUSTOM_JOB_SECRET_3:
# API key for Dependency-Track integration
# Required: false
DTRACK_TOKEN:
with:
# AWS region with GitHub OIDC provider IAM configuration
# Type: string
# Required: false
aws_region: ${{ vars.AWS_REGION || '' }}
# AWS IAM role ARN to assume with GitHub OIDC provider
# Type: string
# Required: false
aws_iam_role: ${{ vars.AWS_IAM_ROLE || '' }}
# GitHub App ID to generate an installation token.
# See https://github.com/tibdex/github-app-token for more info.
# Type: string
# Required: false
app_id: ${{ vars.FLOWZONE_APP_ID || vars.APP_ID }}
# Timeout for the job(s).
# Type: number
# Required: false
jobs_timeout_minutes: 120
# GitHub actions working directory
# Type: string
# Required: false
working_directory: .
# Comma-delimited string of Docker images (without tags) to publish (skipped if empty)
# Type: string
# Required: false
docker_images:
# Comma-delimited string of Docker buildx bake targets to publish (skipped if empty)
# Type: string
# Required: false
bake_targets: default
# Invert the tags for the Docker images (e.g. `{tag}-{variant}` becomes `{variant}-{tag}`)
# Type: boolean
# Required: false
docker_invert_tags: false
# Publish platform-specific tags in addition to multi-arch manifests (e.g.
# `product-os/flowzone:latest-amd64`)
# Type: boolean
# Required: false
docker_publish_platform_tags: false
# JSON array of docker compose tests, each an object with the `service` to run and an
# optional compose `profile` to activate, for example:
# `[{"service": "sut"},{"profile": "e2e", "service": "sut-e2e"}]`
# Entries run one after another in each docker test job, and the image artifact is only
# uploaded once all of them have passed. The base composition (no profile) is always
# rendered and built first, with the profiles overlaid on top. If empty, the `sut` service
# is run without a profile.
# Type: string
# Required: false
docker_compose_profiles:
# balenaCloud environment
# Type: string
# Required: false
balena_environment: balena-cloud.com
# Comma-delimited string of balenaCloud apps, fleets, or blocks to deploy (skipped if empty)
# Type: string
# Required: false
balena_slugs:
# Comma-delimited string of Rust stable targets to publish (skipped if empty)
# Type: string
# Required: false
cargo_targets: >
aarch64-unknown-linux-gnu,
armv7-unknown-linux-gnueabihf,
arm-unknown-linux-gnueabihf,
x86_64-unknown-linux-gnu,
i686-unknown-linux-gnu
# Set to true to publish Rust binary release artifacts to GitHub
# Type: boolean
# Required: false
rust_binaries: false
# Set to true to enable terminal emulation for test steps
# Type: boolean
# Required: false
pseudo_terminal: false
# Set to true to disable automatic versioning
# Type: boolean
# Required: false
disable_versioning: false
# JSON array of runner label strings for default jobs.
# Type: string
# Required: false
runs_on: >
[
"ubuntu-24.04"
]
# JSON key-value pairs mapping platforms to arrays of runner labels. Unlisted platforms will
# use `runs_on`.
# Type: string
# Required: false
docker_runs_on: >
{
"linux/amd64": ["ubuntu-24.04"],
"linux/arm64": ["ubuntu-24.04-arm"],
"linux/arm/v7": ["ubuntu-24.04-arm"],
"linux/arm/v6": ["ubuntu-24.04-arm"]
}
# JSON array of runner label strings for cloudformation jobs.
# Type: string
# Required: false
cloudformation_runs_on:
# Setting this to your existing CF pages project name will generate and deploy a website.
# Skipped if empty.
# Type: string
# Required: false
cloudflare_website:
# Set to false to disable building a docusaurus website. If false the script `npm run
# deploy-docs` will be run if it exists.
# Type: boolean
# Required: false
docusaurus_website: true
# Finalize releases on merge.
# Type: boolean
# Required: false
github_prerelease: false
# Deprecated and ignored. Fork pull requests now run without secrets, so custom actions no
# longer need to be restricted on forks (custom test runs on forks; custom
# publish/finalize/always stay trusted-only). Remove this input; it will be dropped in a
# future release.
# Type: boolean
# Required: false
restrict_custom_actions: true
# JSON matrix strategy for the custom test action. Properties 'environment' and 'os' will be
# applied to the job.
# Type: string
# Required: false
custom_test_matrix:
# JSON matrix strategy for the custom publish action. Properties 'environment' and 'os' will
# be applied to the job.
# Type: string
# Required: false
custom_publish_matrix:
# JSON matrix strategy for the custom finalize action. Properties 'environment' and 'os'
# will be applied to the job.
# Type: string
# Required: false
custom_finalize_matrix:
# Deprecated. Add the 'os' property in custom_test_matrix, custom_publish_matrix, and
# custom_finalize_matrix instead.
# Type: string
# Required: false
custom_runs_on:
# Set to false to disable toggling auto-merge on PRs.
# Type: boolean
# Required: false
toggle_auto_merge: true
# Create git tags and a PR comment with detailed change log.
# Type: boolean
# Required: false
release_notes: false
# Set a max parallel value for ALL matrix strategy jobs.
# Type: number
# Required: false
max_parallel: 20
# Concurrency group for the balena publish job, across workflow runs. Jobs in the group run
# one at a time and queue instead of canceling. Empty means no shared group.
# Type: string
# Required: false
balena_publish_concurrency_group:
# Generate a Software Bill of Materials (SBOM) for the release.
# Type: boolean
# Required: false
generate_sbom: true
# Require every .gitmodules submodule to declare a branch, and its pinned commit to be on
# it.
# Type: boolean
# Required: false
check_gitmodules_branches: false
Merging
Flowzone only supports merging with a merge commit. This option is shown as Merge pull request on an in-progress PR.
Avoid using Squash and merge or Rebase and merge as these methods will result in a new commit SHA not matching anything from the original PR. This would prevent Flowzone from finding and finalizing existing draft artifacts.
You can read more about the available merge methods here.
Config Migrations
Flowzone's caller contract changes over time. A caller workflow that has drifted from it gets no other signal — nothing fails, and features quietly stop applying — so the Check config job reports the drift as warnings on every run.
The job reports what flowzonify would change in your .github/workflows/flowzone.yml. It holds no token, cannot write to your repository, and is not part of the All jobs check, so it never gates a merge.
To act on a warning, migrate your caller workflow yourself and review the diff:
npx flowzonify
Some workflows cannot be migrated automatically — a customised if: on the Flowzone job, for instance. Those are reported as needing a manual migration, with the reason.
External Contributions
Flowzone runs external contributions (PRs from forks) without secrets. A fork pull_request builds and tests in an untrusted lane: GitHub withholds secrets and issues a read-only token for workflows triggered by a fork PR, so no registry, cloud, or deploy credentials are ever exposed to fork-authored code. There is no approval gate and no pull_request_target — untrusted code never runs in the base repository's trusted context.
Because forks have no secrets, they cannot publish during the PR. Fork contributions publish on the push to the default branch after merge, rebuilt from the merged (trusted) commit — never from bytes uploaded by the fork. Internal PRs are unchanged — they run on pull_request with full secrets and finalize on merge.
Consequences and limits:
- Breaking change — callers must update to support forks. The old caller snippet routed fork PRs to
pull_request_targetwith anif:condition. Flowzone no longer runs onpull_request_target, so that routing now rejects fork PRs (and on the pre-migration Flowzone it fails to check out the fork). Adopt the new usage snippet: removing thepull_request_targettrigger and its routingif:sends fork PRs to the no-secretspull_requestlane (enables fork testing), and adding thepushtrigger enables fork publishing. Until a caller updates, its fork PRs do not run through Flowzone. - No secrets during a fork PR. Fork PRs that rely on private submodules or
COMPOSE_VARS-backed compose tests cannot fully run those steps during review; the trusted merge lane rebuilds them with credentials. This is inherent to a no-secrets model. - Publish-path failures surface at merge, not during review, since forks cannot draft-publish while the PR is open.
- Custom actions.
custom_testruns on forks (as untrusted code with no secrets, so there is nothing for it to leak);custom_publish,custom_finalize, andcustom_alwaysrun only on trusted lanes. Write custom test actions so they tolerate absent secrets. (Therestrict_custom_actionsinput is deprecated and ignored — it existed only to keep fork custom code out of the trustedpull_request_targetcontext, which no longer exists. Flowzone warns if it is set; it will be removed in a future release.) - Auto-merge is internal-only (it needs an app token). For fork auto-merge, install bulldozer and configure a per-repo
.bulldozer.yml. - Self-hosted runners and forks.
runs_on/docker_runs_onare caller inputs and Flowzone does not override them. A fork job may use self-hosted runners only if they are ephemeral and isolated — provisioned just-in-time, torn down per job, with no persistent tool-cache or disk and no reachable internal network or IAM. The risk is persistent runner state bridging an untrusted fork job into a later trusted one; Flowzone cannot enforce this, so it is org runner-group policy (see #534). Also enable "Require approval for all outside collaborators".
See the usage examples to get started, and docs/trust-boundary.md for the full design and rationale.