Skip to content

Update hardcoded branch name in workflow files when default branch is renamed #111

@wrigjl

Description

@wrigjl

Problem

All three workflow files hardcode ReduxAPI_GUI as the branch name in their on: trigger filters:

  • .github/workflows/code-analysis.ymlpush and pull_request filters (lines 17–18)
  • .github/workflows/main.ymlpull_request filter
  • .github/workflows/publish.ymlpush filter

If the default branch is ever renamed, these workflows will silently stop triggering on push and pull_request events to the new default branch.

Fix

Replace the hardcoded ReduxAPI_GUI with GitHub's $default-branch token in each branches: filter:

on:
  push:
    branches: [ $default-branch ]
  pull_request:
    branches: [ $default-branch ]

$default-branch is a GitHub-recognized token in branches: filters that resolves to whatever the repository's current default branch is set to. This makes the workflows resilient to future branch renames without any further changes.

Why now

The Redux project is considering renaming default branches across its repositories. Updating the workflows first (or alongside the rename) avoids a window where CI stops running on the new default branch.

See also: ReduxISU/Redux#295 for the same change in the backend repo.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions