workflows/pr: refactor base/head branch decision making

Some jobs purposefully only run on certain base or head branches. By
centralizing the logic, parts of it can easily be re-used later. Also,
this gives them an explicit name and thus makes them easier to
understand.

(cherry picked from commit 7763be5a80)
This commit is contained in:
Wolfgang Walther
2025-06-20 12:41:29 +02:00
committed by github-actions[bot]
parent 45b63d2695
commit 9a42b59630
7 changed files with 143 additions and 26 deletions

View File

@@ -2,6 +2,10 @@ name: Check
on:
workflow_call:
inputs:
baseBranch:
required: true
type: string
permissions: {}
@@ -12,9 +16,7 @@ defaults:
jobs:
no-channel-base:
name: no channel base
if: |
startsWith(github.base_ref, 'nixos-') ||
startsWith(github.base_ref, 'nixpkgs-')
if: contains(fromJSON(inputs.baseBranch).type, 'channel')
runs-on: ubuntu-24.04-arm
steps:
- run: |
@@ -29,8 +31,7 @@ jobs:
cherry-pick:
if: |
github.event_name == 'pull_request' ||
startsWith(github.base_ref, 'release-') ||
(startsWith(github.base_ref, 'staging-') && github.base_ref != 'staging-next')
fromJSON(inputs.baseBranch).stable
permissions:
pull-requests: write
runs-on: ubuntu-24.04-arm