-
Notifications
You must be signed in to change notification settings - Fork 0
38 lines (33 loc) · 1.07 KB
/
removed_runner.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
# This simple workflow is used to test if a runner is removed from GitHub platform.
name: Test registered runner
on:
workflow_call:
inputs:
runner-name:
required: true
type: string
must-exist:
type: boolean
default: false
secrets:
READ_REPO_TOKEN:
required: true
permissions:
contents: read
jobs:
test-removed-runner:
name: Test Removed Runner
runs-on: ubuntu-latest
steps:
- name: Check runner removed
if: inputs.must-exist == false
run: |
( gh api "repos/zama-ai/slab-github-runner/actions/runners" --jq '.runners[].name' | grep --line-regexp -q "${{ inputs.runner-name }}" ) && { exit 1; } || exit 0
env:
GH_TOKEN: ${{ secrets.READ_REPO_TOKEN }}
- name: Check runner persists
if: inputs.must-exist == true
run: |
( gh api "repos/zama-ai/slab-github-runner/actions/runners" --jq '.runners[].name' | grep --line-regexp -q "${{ inputs.runner-name }}" ) || exit 1
env:
GH_TOKEN: ${{ secrets.READ_REPO_TOKEN }}