Skip to content

Conversation

@jrhoads
Copy link
Member

@jrhoads jrhoads commented Oct 27, 2025

Purpose

This PR introduces a GitHub Actions workflow to enforce a specific promotion path for pull requests. This ensures that code changes are promoted through predefined branches in a controlled manner, preventing accidental or incorrect deployments.

Approach

A new workflow file, .github/workflows/flow-guard.yml, has been added. This workflow is triggered on pull request events (opened, synchronized, reopened). It checks the base and head branches of the pull request to validate that the promotion path adheres to the following rules:

  • Pull requests targeting staging must originate from dev.
  • Pull requests targeting master must originate from staging.

If the promotion path is invalid, the workflow will fail, informing the user of the error.

Key Modifications

  • Added .github/workflows/flow-guard.yml to define the GitHub Actions workflow.
  • Implemented logic to validate the base and head branches of pull requests.
  • Defined specific rules for promotions to staging and master branches.

Important Technical Details

  • The workflow uses github.event.pull_request.base.ref and github.event.pull_request.head.ref to access the target and source branches, respectively.
  • The script uses simple bash conditional statements to check branch names and exit with an error code if the promotion path is invalid.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

@jrhoads jrhoads merged commit e6996a7 into dev Oct 27, 2025
2 checks passed
@jrhoads jrhoads deleted the flow-guard branch October 27, 2025 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants