From 08a6a3cba8079db0a3940a9b69ae2b35e37398bd Mon Sep 17 00:00:00 2001 From: MaxsTechReview Date: Sun, 8 Nov 2026 11:40:12 -0500 Subject: [PATCH] ci: run approved fork PR compile jobs on the disposable fork runner (#2246) * ci: run approved fork PR compile jobs on the disposable fork runner * ci: ignore fork runner heartbeats from the future * ci: target the fork runner by its own label * Read the fork runner heartbeat from a public gist * Fall back to an anonymous read of the fork runner heartbeat --- .github/workflows/pick-runner.yml | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pick-runner.yml b/.github/workflows/pick-runner.yml index 5eee6bc57..cb2a0b0ff 100644 --- a/.github/workflows/pick-runner.yml +++ b/.github/workflows/pick-runner.yml @@ -17,7 +17,7 @@ jobs: runs-on: ubuntu-24.04 timeout-minutes: 2 outputs: - labels: ${{ steps.runner.outputs.labels || '"ubuntu-24.04"' }} + labels: ${{ steps.runner.outputs.labels || steps.fork.outputs.labels || '"ubuntu-24.04"' }} steps: - name: Pick the compile runner id: runner @@ -36,3 +36,25 @@ jobs: fi echo "labels=$labels" >> "$GITHUB_OUTPUT" echo "Compile runner: \`$labels\`" >> "$GITHUB_STEP_SUMMARY" + - name: Pick the fork runner + id: fork + if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository + continue-on-error: true + env: + GH_TOKEN: ${{ github.token }} + run: | + set -euo pipefail + labels='"ubuntu-24.04"' + gist=https://api.github.com/gists/0c7ed7ad6d6493de84f5123689c64ae6 + body=$(curl -fsS --max-time 15 -H "Authorization: Bearer $GH_TOKEN" "$gist" 2>/dev/null || curl -fsS --max-time 15 "$gist" 2>/dev/null || echo '{}') + IDLE_AT=$(jq -r 'select(.owner.login == "maxjivi05") | .files["idle-at"].content // "0"' <<< "$body" 2>/dev/null || echo 0) + echo "Heartbeat: ${IDLE_AT:-none}" + age=-1 + if [[ "${IDLE_AT:-0}" =~ ^[0-9]+$ ]] && [ "${IDLE_AT:-0}" -gt 0 ]; then + age=$(( $(date +%s) - IDLE_AT )) + fi + if [ "$age" -ge 0 ] && [ "$age" -lt 180 ]; then + labels='"droiddeck-fork"' + fi + echo "labels=$labels" >> "$GITHUB_OUTPUT" + echo "Compile runner: \`$labels\`" >> "$GITHUB_STEP_SUMMARY"