fix(ci): skip promote-main-to-next check gate for non-main sources

Run validate-main-green-ci only when source_branch is main; feature
branches often lack ci-ok. Allow promote when validation is skipped
and log when the gate was bypassed.
This commit is contained in:
Maxim Isaev
2026-05-04 18:11:15 +03:00
parent e4bd86e587
commit 442577abd1
+7 -1
View File
@@ -4,7 +4,7 @@ on:
workflow_dispatch: workflow_dispatch:
inputs: inputs:
source_branch: source_branch:
description: "Source branch to promote into next (default main)" description: "Source branch to promote into next (default main). Required ci-ok checks run only when this is main."
required: false required: false
default: main default: main
type: string type: string
@@ -16,6 +16,7 @@ on:
jobs: jobs:
validate-main: validate-main:
if: inputs.source_branch == 'main'
uses: ./.github/workflows/validate-main-green-ci.yml uses: ./.github/workflows/validate-main-green-ci.yml
with: with:
branch: ${{ inputs.source_branch }} branch: ${{ inputs.source_branch }}
@@ -23,6 +24,7 @@ jobs:
promote: promote:
needs: validate-main needs: validate-main
if: ${{ !cancelled() && (needs.validate-main.result == 'success' || needs.validate-main.result == 'skipped') }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
contents: write contents: write
@@ -30,6 +32,10 @@ jobs:
env: env:
SOURCE_BRANCH: ${{ inputs.source_branch }} SOURCE_BRANCH: ${{ inputs.source_branch }}
steps: steps:
- name: note when CI gate was skipped
if: inputs.source_branch != 'main'
run: |
echo "Skipping required-check validation: source_branch is '${{ inputs.source_branch }}', not main."
- uses: actions/checkout@v5 - uses: actions/checkout@v5
with: with:
fetch-depth: 0 fetch-depth: 0