Skip to content

Commit c3ede5b

Browse files
committed
ci: do not build the commits of a pull request that change no code
"Each commit builds and tests" built every commit of a pull request one after another. A stack of 20 commits ran into the 25 minute limit even though nine of them only touch documentation, and a documentation commit cannot break the build. The loop now asks .github/scripts/detect_code_changes.sh about each commit and skips the ones that change no code. The script is copied out of the work tree first, because checking out an older commit removes it. Assisted-by: Claude:claude-sonnet-5-5 Signed-off-by: Thecave3 <thecave003@gmail.com>
1 parent 82fe1fe commit c3ede5b

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

‎.github/workflows/commit-trailers.yml‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,16 @@ jobs:
150150
base="${{ github.event.pull_request.base.sha }}"
151151
head="${{ github.event.pull_request.head.sha }}"
152152
set -e
153+
# A commit that changes only documentation cannot break the build, so it
154+
# is not built. The script is copied out first: checking out an older
155+
# commit would remove it from the work tree.
156+
detect="$(mktemp)"
157+
cp .github/scripts/detect_code_changes.sh "$detect"
153158
for sha in $(git rev-list --reverse "$base..$head"); do
159+
if [ "$(bash "$detect" "$sha^" "$sha" 2>/dev/null)" = "false" ]; then
160+
echo "Skipping commit $sha: it changes no code"
161+
continue
162+
fi
154163
echo "::group::Building commit $sha"
155164
git -c advice.detachedHead=false checkout --quiet --detach "$sha"
156165
chmod +x ./build_libe3 || true

0 commit comments

Comments
 (0)