···21jobs:
22 ci-config:
23 name: config
024 runs-on: ubuntu-latest
25 outputs:
26 enabled: ${{ steps.check-ref.outputs.enabled }}${{ steps.skip-if-redundant.outputs.enabled }}
···43 name: check whether CI is enabled for ref
44 run: |
45 enabled=yes
46- if test -x config-repo/ci/config/allow-ref &&
47- ! config-repo/ci/config/allow-ref '${{ github.ref }}'
48 then
49- enabled=no
000050 fi
5152 skip_concurrent=yes
···21jobs:
22 ci-config:
23 name: config
24+ if: vars.CI_BRANCHES == '' || contains(vars.CI_BRANCHES, github.ref_name)
25 runs-on: ubuntu-latest
26 outputs:
27 enabled: ${{ steps.check-ref.outputs.enabled }}${{ steps.skip-if-redundant.outputs.enabled }}
···44 name: check whether CI is enabled for ref
45 run: |
46 enabled=yes
47+ if test -x config-repo/ci/config/allow-ref
048 then
49+ echo "::warning::ci/config/allow-ref is deprecated; use CI_BRANCHES instead"
50+ if ! config-repo/ci/config/allow-ref '${{ github.ref }}'
51+ then
52+ enabled=no
53+ fi
54 fi
5556 skip_concurrent=yes
+14
ci/config/README
···00000000000000
···1+You can configure some aspects of the GitHub Actions-based CI on a
2+per-repository basis by setting "variables" and "secrets" from with the
3+GitHub web interface. These can be found at:
4+5+ https://github.com/<user>/git/settings/secrets/actions
6+7+The following variables can be used:
8+9+ - CI_BRANCHES
10+11+ By default, CI is run when any branch is pushed. If this variable is
12+ non-empty, then only the branches it lists will run CI. Branch names
13+ should be separated by spaces, and should use their shortened form
14+ (e.g., "main", not "refs/heads/main").
-27
ci/config/allow-ref.sample
···1-#!/bin/sh
2-#
3-# Sample script for enabling/disabling GitHub Actions CI runs on
4-# particular refs. By default, CI is run for all branches pushed to
5-# GitHub. You can override this by dropping the ".sample" from the script,
6-# editing it, committing, and pushing the result to the "ci-config" branch of
7-# your repository:
8-#
9-# git checkout -b ci-config
10-# cp allow-ref.sample allow-ref
11-# $EDITOR allow-ref
12-# git add allow-ref
13-# git commit -am "implement my ci preferences"
14-# git push
15-#
16-# This script will then be run when any refs are pushed to that repository. It
17-# gets the fully qualified refname as the first argument, and should exit with
18-# success only for refs for which you want to run CI.
19-20-case "$1" in
21-# allow one-off tests by pushing to "for-ci" or "for-ci/mybranch"
22-refs/heads/for-ci*) true ;;
23-# always build your integration branch
24-refs/heads/my-integration-branch) true ;;
25-# don't build any other branches or tags
26-*) false ;;
27-esac