[PR #1344] [MERGED] fix(ci): move path vars to workflow-level env so fork PRs can build #9038

Closed
opened 2026-05-03 01:14:40 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/harvard-edge/cs249r_book/pull/1344
Author: @profvjreddi
Created: 4/16/2026
Status: Merged
Merged: 4/16/2026
Merged by: @profvjreddi

Base: devHead: fix/labs-ci-fork-pr-variable


📝 Commits (1)

  • b677579 fix(ci): move path vars to workflow-level env so fork PRs can build

📊 Changes

3 files changed (+30 additions, -9 deletions)

View changed files

📝 .github/workflows/kits-validate-dev.yml (+10 -3)
📝 .github/workflows/labs-validate-dev.yml (+10 -3)
📝 .github/workflows/mlsysim-validate-dev.yml (+10 -3)

📄 Description

problem

repository variables (vars.LABS_ROOT, vars.KITS_ROOT, vars.MLSYSIM_DOCS) are not exposed to workflows triggered by pull_request events from forks. this is a github security default, not a misconfiguration.

when a fork PR modifies files under labs/, kits/, or mlsysim/, the validate-dev workflow runs and vars.* resolves to empty string. this causes:

  • working-directory: ${{ vars.LABS_ROOT }} becomes empty, so quarto render runs from the repo root instead of labs/
  • the validation step looks for /_build/index.html (absolute root with leading slash) instead of labs/_build/index.html
  • quarto exits quickly with nothing to render and the index.html check fails

evidence: on #1306, #1331, #1339 the CI log shows if [ ! -f "/_build/index.html" ]. on dev it shows if [ ! -f "labs/_build/index.html" ]. same workflow, different resolution depending on fork vs non-fork context.

fix

declare the path at workflow level via env:, not vars:. workflow env is available in all contexts including fork PRs. the abstraction (named variable) is preserved, storage just moves from repo-level to file-level. the value is effectively a constant anyway.

changed files:

  • .github/workflows/labs-validate-dev.ymlLABS_ROOT: labs
  • .github/workflows/kits-validate-dev.ymlKITS_ROOT: kits
  • .github/workflows/mlsysim-validate-dev.ymlMLSYSIM_DOCS: mlsysim/docs

scope

only the three validate-dev workflows that trigger on pull_request events. other workflows using vars.* run on push, workflow_run, or workflow_dispatch where repo vars are available, so they are correct as written.

impact

once merged, re-running CI on open fork PRs (#1306, #1331, #1339) will use this fixed workflow file and produce real build signal for the first time. the three fork PRs have been stuck on this CI failure for days through no fault of their authors.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/harvard-edge/cs249r_book/pull/1344 **Author:** [@profvjreddi](https://github.com/profvjreddi) **Created:** 4/16/2026 **Status:** ✅ Merged **Merged:** 4/16/2026 **Merged by:** [@profvjreddi](https://github.com/profvjreddi) **Base:** `dev` ← **Head:** `fix/labs-ci-fork-pr-variable` --- ### 📝 Commits (1) - [`b677579`](https://github.com/harvard-edge/cs249r_book/commit/b6775791b2a471003dd10bb4f0ba4b50a2a0dd22) fix(ci): move path vars to workflow-level env so fork PRs can build ### 📊 Changes **3 files changed** (+30 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/kits-validate-dev.yml` (+10 -3) 📝 `.github/workflows/labs-validate-dev.yml` (+10 -3) 📝 `.github/workflows/mlsysim-validate-dev.yml` (+10 -3) </details> ### 📄 Description ## problem repository variables (`vars.LABS_ROOT`, `vars.KITS_ROOT`, `vars.MLSYSIM_DOCS`) are not exposed to workflows triggered by `pull_request` events from forks. this is a github security default, not a misconfiguration. when a fork PR modifies files under `labs/`, `kits/`, or `mlsysim/`, the validate-dev workflow runs and `vars.*` resolves to empty string. this causes: - `working-directory: ${{ vars.LABS_ROOT }}` becomes empty, so `quarto render` runs from the repo root instead of `labs/` - the validation step looks for `/_build/index.html` (absolute root with leading slash) instead of `labs/_build/index.html` - quarto exits quickly with nothing to render and the index.html check fails evidence: on #1306, #1331, #1339 the CI log shows `if [ ! -f "/_build/index.html" ]`. on dev it shows `if [ ! -f "labs/_build/index.html" ]`. same workflow, different resolution depending on fork vs non-fork context. ## fix declare the path at workflow level via `env:`, not `vars:`. workflow env is available in all contexts including fork PRs. the abstraction (named variable) is preserved, storage just moves from repo-level to file-level. the value is effectively a constant anyway. changed files: - `.github/workflows/labs-validate-dev.yml` — `LABS_ROOT: labs` - `.github/workflows/kits-validate-dev.yml` — `KITS_ROOT: kits` - `.github/workflows/mlsysim-validate-dev.yml` — `MLSYSIM_DOCS: mlsysim/docs` ## scope only the three validate-dev workflows that trigger on `pull_request` events. other workflows using `vars.*` run on `push`, `workflow_run`, or `workflow_dispatch` where repo vars are available, so they are correct as written. ## impact once merged, re-running CI on open fork PRs (#1306, #1331, #1339) will use this fixed workflow file and produce real build signal for the first time. the three fork PRs have been stuck on this CI failure for days through no fault of their authors. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-05-03 01:14:40 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/cs249r_book#9038