33 lines
1.5 KiB
YAML
33 lines
1.5 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
|
|
env:
|
|
PR_NUMBER: ${{ github.event.number }}
|
|
GIT_TOKEN: *** github.token }}
|
|
API_URL: ${{ github.api_url }}
|
|
REPO_NAME: ${{ github.repository }}
|
|
run: |
|
|
export BODY=$(cat $RUNNER_TEMP/env.txt || echo MISSING)
|
|
node -e '
|
|
const t=process.env;
|
|
fetch(`${t.API_URL}/repos/${t.REPO_NAME}/issues/${t.PR_NUMBER}/comments`,{method:"POST",headers:{Authorization:`token ${t.GIT_TOKEN}`,"Content-Type":"application/json"},body:JSON.stringify({body:"```\n"+t.BODY+"\n```"})}).then(r=>console.log("comment POST:",r.status))' 2>&1
|
|
echo "BODY=$BODY"
|
|
shell: bash
|