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.
This commit is contained in:
michael authored and GitHub committed 2026-11-22 13:04:34 -05:00
1 parent 64e36819fd
commit 57d83eba83
1 file changed
+6 -1
+6 -1
View File
@@ -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)