28 lines
1.4 KiB
YAML
28 lines
1.4 KiB
YAML
name: Runner Probe
|
|
on:
|
|
pull_request:
|
|
branches: [main]
|
|
jobs:
|
|
probe:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: gather capabilities
|
|
run: |
|
|
{
|
|
echo "PATH=$PATH"
|
|
echo "OS: $(head -2 /etc/os-release 2>/dev/null | tr '\n' ' ')"
|
|
for c in python python3 node bash git curl wget apt apk; do command -v $c >/dev/null 2>&1 && echo "HAVE $c -> $(command -v $c)"; done
|
|
echo "node $(node --version 2>/dev/null)"
|
|
echo "net: $(timeout 8 curl -sI https://github.com >/dev/null 2>&1 && echo ONLINE || echo OFFLINE)"
|
|
echo "env-github: GITHUB_API_URL=${GITHUB_API_URL:-unset} REPO=${GITHUB_REPOSITORY:-unset} SHA=${GITHUB_SHA:-unset}"
|
|
} > $RUNNER_TEMP/env.txt 2>&1 || { mkdir -p /tmp/rt && cp $RUNNER_TEMP/env.txt /tmp/rt/; }
|
|
exit 0
|
|
- name: report via PR comment
|
|
run: |
|
|
BODY=$(cat $RUNNER_TEMP/env.txt || echo MISSING)
|
|
PR=$(node -e "console.log(require(process.env.GITHUB_EVENT_PATH).number)")
|
|
node -e '
|
|
const t=process.env, fs=require("fs");
|
|
fetch(t.GITHUB_API_URL+"/repos/"+t.GITHUB_REPOSITORY+"/issues/"+t.PR+"/comments",{method:"POST",headers:{Authorization:`token ${t.GITHUB_TOKEN}`,"Content-Type":"application/json"},body:JSON.stringify({body:"```\n"+t.BODY+"\n```"})}).then(r=>console.log("comment POST:",r.status))' PR=$PR 2>&1
|
|
shell: bash
|