Skip to content

Commit 387ec4b

Browse files
fix artifact extraction and previous version check
1 parent 44eee6e commit 387ec4b

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

.github/workflows/render-and-publish.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,21 @@ jobs:
7575
- name: Detect changed Clojure sources
7676
if: github.event_name == 'push'
7777
id: changed_clj
78+
env:
79+
GH_TOKEN: ${{ github.token }}
80+
REPO: ${{ github.repository }}
7881
run: |
7982
set -euo pipefail
8083
git fetch origin main:refs/remotes/origin/main
81-
changed=$(git diff --name-only --diff-filter=ACMR origin/main...HEAD -- 'src/**/*.clj' | tr '\n' ' ')
84+
# Get the commit of the previous successful run (where the artifact came from)
85+
latest_run=$(gh api "/repos/$REPO/actions/workflows/render-and-publish.yml/runs?branch=main&status=success&per_page=1" --jq '.workflow_runs[0].head_commit' || true)
86+
if [ -z "${latest_run:-}" ] || [ "${latest_run}" = "null" ]; then
87+
echo "No previous commit found; doing full rebuild."
88+
echo "files=" >> "$GITHUB_OUTPUT"
89+
exit 0
90+
fi
91+
echo "Comparing against previous artifact commit: $latest_run"
92+
changed=$(git diff --name-only --diff-filter=ACMR "$latest_run" HEAD -- 'src/**/*.clj' | tr '\n' ' ')
8293
if [ -z "$changed" ]; then
8394
echo "No changed Clojure sources detected."
8495
echo "files=" >> "$GITHUB_OUTPUT"

0 commit comments

Comments
 (0)