Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/runner-health.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ jobs:
timeout-minutes: 15
env:
GH_TOKEN: ${{ secrets.RUNNER_PAT || github.token }}
RUNNER_NAME: MyLocalPC
MONITORED_RUNNER_NAME: CAS-Workstation-Kim
Comment thread
OgeonX-Ai marked this conversation as resolved.
EMAIL_TO: ${{ secrets.EMAIL_TO }}
steps:
- name: Check runner status
id: status
run: |
set -euo pipefail
status=""
if ! status="$(gh api repos/${GITHUB_REPOSITORY}/actions/runners --jq ".runners[] | select(.name==\"${RUNNER_NAME}\") | .status")"; then
if ! status="$(gh api repos/${GITHUB_REPOSITORY}/actions/runners --jq ".runners[] | select(.name==\"${MONITORED_RUNNER_NAME}\") | .status")"; then
status="unknown"
fi
if [ -z "${status}" ]; then
Expand All @@ -36,15 +36,15 @@ jobs:
if: steps.status.outputs.runner_status != 'online'
run: |
set -euo pipefail
title="Runner offline: ${RUNNER_NAME}"
title="Runner offline: ${MONITORED_RUNNER_NAME}"
marker="Autopilot Runner Health"
status="${{ steps.status.outputs.runner_status }}"
gh label create runner-offline --color "B60205" --description "Runner offline alerts" --force --repo "${GITHUB_REPOSITORY}" || true
existing="$(gh issue list -s open -l runner-offline -S "${title}" --repo "${GITHUB_REPOSITORY}" --json number --jq '.[0].number')"
body=$(cat <<EOF
${marker}

Runner: ${RUNNER_NAME}
Runner: ${MONITORED_RUNNER_NAME}
Status: ${status}
Repo: ${GITHUB_REPOSITORY}
Time: $(date -u +"%Y-%m-%dT%H:%M:%SZ")
Expand Down Expand Up @@ -76,9 +76,9 @@ jobs:
server_port: ${{ env.SMTP_PORT }}
username: ${{ env.SMTP_USERNAME }}
password: ${{ env.SMTP_PASSWORD }}
subject: "Runner offline: MyLocalPC"
subject: "Runner offline: ${{ env.MONITORED_RUNNER_NAME }}"
body: |
Runner: MyLocalPC
Runner: ${{ env.MONITORED_RUNNER_NAME }}
Repo: ${{ github.repository }}
Status: ${{ steps.status.outputs.runner_status }}
to: ${{ env.EMAIL_TO }}
Expand Down
8 changes: 8 additions & 0 deletions memory/examples/20260710_runner-health-reserved-variable.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Runner health target variable

Issue Description: Runner Health Monitor created alerts for its GitHub-hosted monitor instead of the intended self-hosted runner.
State: The workflow defined `RUNNER_NAME`, which GitHub Actions reserves for the executing runner and overwrote at runtime.
Action: Renamed the target variable to `MONITORED_RUNNER_NAME` and added a regression test for the workflow contract.
Result: Health checks now query and report the configured self-hosted runner name.
Diff Patch: Updated `.github/workflows/runner-health.yml` and added `tests/test_runner_health_workflow.py`.
Rationale: Workflow environment variables must not collide with GitHub Actions built-ins.
11 changes: 11 additions & 0 deletions tests/test_runner_health_workflow.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from pathlib import Path


def test_runner_health_uses_non_reserved_target_name() -> None:
workflow = Path(".github/workflows/runner-health.yml").read_text(encoding="utf-8")

assert "MONITORED_RUNNER_NAME: CAS-Workstation-Kim" in workflow
assert "${MONITORED_RUNNER_NAME}" in workflow
assert "RUNNER_NAME: MyLocalPC" not in workflow
assert 'subject: "Runner offline: ${{ env.MONITORED_RUNNER_NAME }}"' in workflow
assert "Runner: ${{ env.MONITORED_RUNNER_NAME }}" in workflow