Skip to content

Instantly share code, notes, and snippets.

@amonshiz
Created April 28, 2026 20:07
Show Gist options
  • Select an option

  • Save amonshiz/6f36dae8c0a400d1a6633d4ae7c9a046 to your computer and use it in GitHub Desktop.

Select an option

Save amonshiz/6f36dae8c0a400d1a6633d4ae7c9a046 to your computer and use it in GitHub Desktop.
BUILDS-791: macros job-determination ordering fix — before/after demo

BUILDS-791: Macros job-determination ordering fix

2026-04-28T20:07:22Z by Showboat 0.6.1

Macro source/test code lives under Macros/DuolingoMacros/Sources/ and Macros/DuolingoMacros/Tests/. Before this PR, the substring check on "Sources" in filename or "Tests" in filename ran before the Macros/ prefix branch in .github/actions/job-determination/job_selection.py, so changes inside macro code matched first and were continue'd — the macros job was never triggered.

Both runs below feed the same input — a single changed file at Macros/DuolingoMacros/Sources/ArchGeneratorMacros/Generators/SomeGenerator.swift — first against HEAD~1 (pre-fix) and then against HEAD (this PR).

Setup: write the simulated changed-files list

mkdir -p /tmp/builds-791-demo
cat > /tmp/builds-791-demo/changed-files.json <<'EOF'
["Macros/DuolingoMacros/Sources/ArchGeneratorMacros/Generators/SomeGenerator.swift"]
EOF
cat /tmp/builds-791-demo/changed-files.json
["Macros/DuolingoMacros/Sources/ArchGeneratorMacros/Generators/SomeGenerator.swift"]

Before (HEAD~1)

Run the pre-fix script (extracted from the previous commit) against the same input. Look at the captured GitHub Actions outputs — every job, including macros, is set to false.

cd /Users/amonshiz/Developer/duoios-builds-791
git show HEAD~1:.github/actions/job-determination/job_selection.py > /tmp/builds-791-demo/job_selection_before.py
rm -f /tmp/builds-791-demo/before-actions.txt
uv run --no-project /tmp/builds-791-demo/job_selection_before.py \
  --changed-files /tmp/builds-791-demo/changed-files.json \
  --output /tmp/builds-791-demo/before-output.json \
  --actions-output /tmp/builds-791-demo/before-actions.txt > /dev/null 2>&1
echo '---- GHA outputs (before) ----'
cat /tmp/builds-791-demo/before-actions.txt
---- GHA outputs (before) ----
unit=false
snapshot=false
prototype=false
emerge=false
macros=false
docs=false```

After (HEAD, this PR)

Same input, the fixed script. The (macros - everything) log line confirms the Macros/ branch fired, and macros=true (along with all the other jobs the macros change sweeps in) is now emitted to GitHub Actions outputs.

cd /Users/amonshiz/Developer/duoios-builds-791
rm -f /tmp/builds-791-demo/after-actions.txt
uv run --no-project .github/actions/job-determination/job_selection.py \
  --changed-files /tmp/builds-791-demo/changed-files.json \
  --output /dev/null \
  --actions-output /tmp/builds-791-demo/after-actions.txt 2>&1 | grep -E '(macros|everything)'
echo '---- GHA outputs (after) ----'
cat /tmp/builds-791-demo/after-actions.txt
- Macros/DuolingoMacros/Sources/ArchGeneratorMacros/Generators/SomeGenerator.swift (macros - everything)
    "macros": {
---- GHA outputs (after) ----
unit=true
snapshot=true
prototype=true
emerge=true
macros=true
docs=true```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment