From 60134bc7274617f1183bbe40c6d13d4101192086 Mon Sep 17 00:00:00 2001 From: jcant0n Date: Sat, 1 Aug 2026 14:02:16 +0200 Subject: [PATCH] chore: make workflow branch filters and guards branch-agnostic Prepares the repository for renaming the default branch from master to main without losing CI coverage or silently skipping scheduled jobs. - CI: accept both main and master in push/pull_request filters so there is no window without CI during the rename. - CD and Sync standards: replace the hardcoded `github.ref == 'refs/heads/master'` guard with `github.ref_name == github.event.repository.default_branch`, which resolves at runtime and survives any future rename. With the old guard, a rename would make the scheduled job skip while the run still reported success. - Sync standards: derive target_branch from the repository default branch instead of the 'master' literal, so it stays correct after the rename. Two sibling repositories (OpenGL.NET, WebGPU.NET) have had this workflow failing since April 2026 precisely because that literal drifted from the actual branch name. Co-Authored-By: Claude Opus 5 --- .github/workflows/CD.yml | 2 +- .github/workflows/CI.yml | 4 ++-- .github/workflows/sync-standards.yml | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/CD.yml b/.github/workflows/CD.yml index b77bf81..1ef425b 100644 --- a/.github/workflows/CD.yml +++ b/.github/workflows/CD.yml @@ -16,7 +16,7 @@ on: jobs: cd: - if: github.event_name != 'schedule' || github.ref == 'refs/heads/master' + if: github.event_name != 'schedule' || github.ref_name == github.event.repository.default_branch uses: EvergineTeam/evergine-standards/.github/workflows/binding-simple-cd.yml@v2 with: generator-project: "RenderDocGen/RenderDocGen/RenderDocGen.csproj" # Path to your generator .csproj diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index aa72658..6d69d8f 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -14,9 +14,9 @@ on: type: boolean default: false push: - branches: [ "master" ] + branches: [ "main", "master" ] pull_request: - branches: [ "master" ] + branches: [ "main", "master" ] jobs: ci: diff --git a/.github/workflows/sync-standards.yml b/.github/workflows/sync-standards.yml index a2337b1..3051a8e 100644 --- a/.github/workflows/sync-standards.yml +++ b/.github/workflows/sync-standards.yml @@ -16,8 +16,8 @@ on: default: "v2" required: false target_branch: - description: "Target branch to apply changes" - default: "master" + description: "Target branch to apply changes (defaults to the repository default branch)" + default: "" required: false script_path: description: "Path where to download the sync script" @@ -41,7 +41,7 @@ on: jobs: sync: - if: github.event_name != 'schedule' || github.ref == 'refs/heads/master' + if: github.event_name != 'schedule' || github.ref_name == github.event.repository.default_branch permissions: contents: write # allow push commits pull-requests: write @@ -50,7 +50,7 @@ jobs: org: ${{ github.event.inputs.org || 'EvergineTeam' }} repo: ${{ github.event.inputs.repo || 'evergine-standards' }} ref: ${{ github.event.inputs.ref || 'main' }} - target_branch: ${{ github.event.inputs.target_branch || 'master' }} + target_branch: ${{ github.event.inputs.target_branch || github.event.repository.default_branch }} script_path: ${{ github.event.inputs.script_path || 'sync-standards.ps1' }} commit_message: "${{ github.event.inputs.commit_message || vars.STANDARDS_COMMIT_MESSAGE || 'auto: sync standard files [skip ci]' }}" mode: ${{ github.event.inputs.mode || 'auto' }}