Jobs set GitHub Enterprise's URL variables; campaign reports show longer logs (#119)
Jobs also set GITHUB_CUSTOM_API_URL and GITHUB_CUSTOM_SERVER_URL, so tools like super-linter call Diffinery instead of sending the job token to api.github.com. The campaign report shows 150 log lines per failed job. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AizKXSsengXZRegJxRATkL
Canberk Demirci authored · GitHub committed signed1 parent 3c06911commit 86edf57b8be5b0524e1aeba6b6909c1abcd780caBrowse files
3 files changed+7−2
modifiedapps/diffinery/docs/actions/expressions.md+1−0View file
| @@ -371,6 +371,7 @@ | ||
| 371 | 371 | | `GITHUB_SERVER_URL` | `https://diffinery.com` | |
| 372 | 372 | | `GITHUB_API_URL` | `https://diffinery.com/api/v3` | |
| 373 | 373 | | `GITHUB_GRAPHQL_URL` | `https://diffinery.com/api/graphql`. Set for compatibility only: Diffinery has no GraphQL API yet | |
| 374 | +| `GITHUB_CUSTOM_API_URL`, `GITHUB_CUSTOM_SERVER_URL` | The same as `GITHUB_API_URL` and `GITHUB_SERVER_URL`. Tools built for GitHub Enterprise, such as super-linter, read these; without them they call api.github.com with the job's token | | |
| 374 | 375 | | `GITHUB_WORKFLOW` | The workflow's name, or its path | |
| 375 | 376 | | `GITHUB_WORKFLOW_REF` | `acme/website/.github/workflows/ci.yml@refs/heads/main` | |
| 376 | 377 | | `GITHUB_WORKSPACE` | `/workspace/website` | |
modifiedcontainers/runner/src/job.ts+4−0View file
| @@ -279,6 +279,10 @@ | ||
| 279 | 279 | GITHUB_SERVER_URL: server, |
| 280 | 280 | GITHUB_API_URL: `${server}/api/v3`, |
| 281 | 281 | GITHUB_GRAPHQL_URL: `${server}/api/graphql`, |
| 282 | + // GitHub Enterprise's names for the same two URLs. Tools such as super-linter build api.github.com from a | |
| 283 | + // default domain unless these are set, and would send the job's token there. | |
| 284 | + GITHUB_CUSTOM_API_URL: `${server}/api/v3`, | |
| 285 | + GITHUB_CUSTOM_SERVER_URL: server, | |
| 282 | 286 | GITHUB_WORKFLOW: str(g.workflow ?? spec.workflowPath), |
| 283 | 287 | GITHUB_WORKFLOW_REF: str(g.workflow_ref ?? `${repoFull}/${spec.workflowPath}@${spec.ref}`), |
| 284 | 288 | GITHUB_WORKSPACE: this.workspace, |
modifiedscripts/import-campaign.sh+2−2View file
| @@ -175,8 +175,8 @@ | ||
| 175 | 175 | jobs=$(api GET "/repos/$owner/$name/actions/runs/$run/jobs?per_page=100" || echo '{"jobs":[]}') |
| 176 | 176 | details+="$(jq -r '.jobs[] | "- \(.name): \(.conclusion // .status)\(if .failure then " (\(.failure.message? // .failure))" elif .status != "completed" then " (still \(.status))" else "" end)"' <<<"$jobs")"$'\n' |
| 177 | 177 | for job in $(jq -r '.jobs[] | select(.conclusion == "failure") | .id' <<<"$jobs"); do |
| 178 | - details+=$'\n'"<details><summary>$(jq -r --arg id "$job" '.jobs[] | select((.id | tostring) == $id) | .name' <<<"$jobs") log (last 40 lines)</summary>"$'\n\n```\n' | |
| 179 | - details+="$(curl -fsS "$DIFFINERY/api/v3/repos/$owner/$name/actions/jobs/$job/logs" -H "Authorization: Bearer $TOKEN" | tail -40 || echo "(no log)")" | |
| 178 | + details+=$'\n'"<details><summary>$(jq -r --arg id "$job" '.jobs[] | select((.id | tostring) == $id) | .name' <<<"$jobs") log (last 150 lines)</summary>"$'\n\n```\n' | |
| 179 | + details+="$(curl -fsS "$DIFFINERY/api/v3/repos/$owner/$name/actions/jobs/$job/logs" -H "Authorization: Bearer $TOKEN" | sed -E 's/^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9:.]+Z //' | tail -150 || echo "(no log)")" | |
| 180 | 180 | details+=$'\n```\n</details>\n' |
| 181 | 181 | done |
| 182 | 182 | done |