From 57d83eba83b079847bb64c1ffaf0b9e9be91b456 Mon Sep 17 00:00:00 2001 From: FoggyMtnDrifter Date: Sun, 22 Nov 2026 13:04:34 -0500 Subject: [PATCH] Test only changed recipes on a new branch's first push (#22) The first push of a branch has no previous commit, so CI fell back to testing the whole catalog: slow, and a broken recipe elsewhere failed unrelated changes. Compare with main instead. --- .github/workflows/validate.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index f9e8e9a..bc5748c 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -38,7 +38,12 @@ jobs: env: BASE: ${{ github.event.pull_request.base.sha || github.event.before }} run: | - if [ "$GITHUB_EVENT_NAME" = workflow_dispatch ] || [ -z "$BASE" ] || ! git cat-file -e "$BASE^{commit}" 2>/dev/null; then + # A new branch's first push has no "before" commit (all zeros): compare it with main + # instead, so it tests only the recipes it changes. + if [ -z "$BASE" ] || ! git cat-file -e "$BASE^{commit}" 2>/dev/null; then + BASE=$(git merge-base origin/main HEAD) + fi + if [ "$GITHUB_EVENT_NAME" = workflow_dispatch ]; then apps=$(ls -d apps/*/) else apps=$(git diff --name-only "$BASE" HEAD -- apps/ | cut -d/ -f1-2 | sort -u)