mirror of
https://github.com/bherbruck/solidcraft.git
synced 2026-11-15 13:10:45 +00:00
916b91e8d0
solidcore's main at c0d3cc0124, rewritten to one commit per same-author run per PR (2,800 commits, author credit kept; tree identical). Full original history: tangency-labs/solidcore archive/full-history. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> git-subtree-dir: solidcore git-subtree-mainline:44525da669git-subtree-split:c440e5f892
31 lines
1.7 KiB
Bash
Executable File
Vendored
31 lines
1.7 KiB
Bash
Executable File
Vendored
#!/usr/bin/env bash
|
|
# Prints the CI `changes` job outputs (code=, full=) for .github/workflows/ci.yml.
|
|
# code=false only for a pull_request, merge_group or push whose diff against its base (for a
|
|
# push, the commit before it) touches nothing outside DOCS_ONLY (prose read by no build, test or
|
|
# goldens run), so a docs- or site-only merge to main runs no code job either. Anything else, and
|
|
# any doubt (no base, a new branch's all-zero base, fetch failure), is code=true. full=true when
|
|
# code=true and the event is not a push to main (pushes run only the jobs that publish main's
|
|
# artifacts).
|
|
# Usage: changes.sh <event> [base sha]
|
|
set -euo pipefail
|
|
event=${1:?event}; base=${2:-}
|
|
# Paths no cargo build/test, goldens run or packaging reads. Not plan/units/ (the goldens crate reads
|
|
# unit statuses), not crates/** READMEs (cargo package reads them), not scripts/ or harness/.
|
|
DOCS_ONLY='^(plan/findings/.*|plan/upstream-issues/.*|plan/[^/]*\.md|site/.*|docs/.*|assets/.*|[^/]*\.md)$'
|
|
code=true
|
|
if [ "$event" = pull_request ] || [ "$event" = merge_group ] || [ "$event" = push ]; then
|
|
if [ -n "$base" ] && { git cat-file -e "$base^{commit}" 2>/dev/null || git fetch -q --depth=1 origin "$base"; }; then
|
|
# --no-renames: a rename lists both its old and new path, so moving code into a docs path
|
|
# still counts as a code change. Quoted (unusual) paths never match, which fails closed.
|
|
files=$(git diff --no-renames --name-only "$base" HEAD)
|
|
if [ -n "$files" ] && ! grep -qvE "$DOCS_ONLY" <<<"$files"; then
|
|
code=false
|
|
fi
|
|
echo "changed files: $(wc -l <<<"$files"), code=$code" >&2
|
|
fi
|
|
fi
|
|
full=$code
|
|
[ "$event" = push ] && full=false
|
|
echo "code=$code"
|
|
echo "full=$full"
|