Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 24 additions & 8 deletions .github/scripts/determine-targets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,29 @@ NEW_COMMIT=${HEAD_SHA}
echo "OLD_COMMIT=${OLD_COMMIT}"
echo "NEW_COMMIT=${NEW_COMMIT}"

# Determine targets.
# Get a list of changed files, extract the unique directory names under 'apps/'
TARGETS=$(git diff --name-only $OLD_COMMIT $NEW_COMMIT | grep '^apps/' | cut -d'/' -f1-2 | sort -u)
echo "Modified targets: ${TARGETS}"
# Only run pixlet check for apps with Starlark source changes. Manifest,
# preview images, and README edits do not require a render check.
TARGETS=""
while IFS= read -r app; do
[[ -z "${app}" ]] && continue

# Format TARGETS as a space-separated list
TARGETS=$(echo $TARGETS | tr '\n' ' ')
star_changes=$(
git diff --name-only "${OLD_COMMIT}" "${HEAD_SHA}" -- "${app}/" \
| grep -E '\.star$' || true
)

# Record output to GitHub variable.
echo "targets=${TARGETS% }" >> "${GITHUB_OUTPUT}"
if [[ -n "${star_changes}" ]]; then
TARGETS+="${app} "
else
echo "Skipping ${app} (no .star file changes)"
fi
done < <(
git diff --name-only "${OLD_COMMIT}" "${HEAD_SHA}" \
| grep '^apps/' \
| cut -d'/' -f1-2 \
| sort -u
)

TARGETS="${TARGETS%" "}"
echo "Pixlet check targets: ${TARGETS:-none}"
echo "targets=${TARGETS}" >> "${GITHUB_OUTPUT}"
Loading