-
Notifications
You must be signed in to change notification settings - Fork 188
41 lines (39 loc) · 1.16 KB
/
ci-enabled.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
name: Ensure CI is Enabled
# This workflow allows a project to disable workflows based on a repository or
# organizational environment variable.
#
# Create a repo or org environment variable with its value set to 'true'
# for this workflow to succeed. Any other value should cause this workflow
# to fail.
#
# https://docs.github.com/en/actions/learn-github-actions/variables#creating-configuration-variables-for-a-repository
#
# Example usage, assuming this workflow is local to your repository:
#
# jobs:
# ensure_ci_enabled:
# uses: ./.github/workflows/check-ci-enabled.yml
# with:
# is-enabled: ${{ vars.CUSTOM_VAR_CI_ENABLED }}
#
# next_task:
# needs: ensure_ci_enabled
# runs-on: ubuntu-22.04
# steps:
# - ...
on:
workflow_call:
inputs:
is-enabled:
type: string
required: true
jobs:
fail_if_ci_disabled:
runs-on: ubuntu-22.04
steps:
- name: Check enablement value
run: |
test "${{ inputs.is-enabled }}" = "true" \
|| { echo "::error::Halting because this repo/org/env configuration has not explicitly enabled this CI."; \
exit 1 ;}
echo "::notice::CI is enabled!"