strawberry/.forgejo/workflows/runner-probe.yml
trvon 09dd84492f
ci: run the runner probe twice a day
The Security Hub probe on ghost-ci reads the newest successful runner-probe.yml run and
alerts after 26 h; the workflow had no schedule, so it never ran on its own.
2026-11-21 09:44:37 -07:00

47 lines
2 KiB
YAML

# Checks that a Forgejo Actions runner picks up jobs for this repo and can do what
# release.yml needs: run a distro container, clone this private repo with the job
# token, and reach the API. Builds nothing. Runs twice a day on main (the Security Hub
# CI probe on ghost-ci alerts when no successful run is newer than 26 h), from the
# Actions tab (workflow_dispatch), or on a push to the ci/probe branch.
#
# If the job stays "waiting", no runner has the `docker` label: change `runs-on`
# to a label shown under Settings -> Actions -> Runners (here and in release.yml).
name: runner-probe
on:
workflow_dispatch:
push:
branches: [ci/probe]
schedule:
- cron: "17 6,18 * * *"
jobs:
probe:
runs-on: docker
container:
image: debian:trixie
steps:
- name: Environment
run: |
. /etc/os-release; echo "os=$ID $VERSION_CODENAME"
echo "arch=$(dpkg --print-architecture) nproc=$(nproc)"
grep -E 'MemTotal|MemAvailable' /proc/meminfo
echo "server=$GITHUB_SERVER_URL repo=$GITHUB_REPOSITORY ref=$GITHUB_REF sha=$GITHUB_SHA"
- name: Tools
run: |
apt-get update -q && apt-get install -y -q --no-install-recommends git ca-certificates curl python3 >/dev/null
git --version; curl --version | head -1
- name: Clone with the job token
env:
TOKEN: ${{ github.token }}
run: |
git init -q src && cd src
git -c http.extraHeader="Authorization: token $TOKEN" fetch -q --depth 1 "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY.git" "$GITHUB_SHA"
git checkout -q FETCH_HEAD && git log -1 --format='checked out %h %s'
- name: API reachable
env:
TOKEN: ${{ github.token }}
run: |
code=$(curl -s -o /dev/null -w '%{http_code}' -H "Authorization: token $TOKEN" \
"$GITHUB_SERVER_URL/api/v1/repos/$GITHUB_REPOSITORY/releases?limit=1")
echo "releases API http=$code"; test "$code" = 200