|
38 | 38 | fi |
39 | 39 | echo "Downloading Pages artifact from run $latest_run (artifact $artifact_id)." |
40 | 40 | gh api "/repos/$REPO/actions/artifacts/$artifact_id/zip" > /tmp/pages.zip |
41 | | - unzip -q /tmp/pages.zip -d site/_site |
42 | | - echo "Contents of site/_site after artifact unzip:" |
| 41 | + unzip -q /tmp/pages.zip -d /tmp/artifact_unzip |
| 42 | + tar -xf /tmp/artifact_unzip/artifact.tar -C site/_site |
| 43 | + echo "Contents of site/_site after artifact extraction:" |
43 | 44 | ls -la site/_site | head -50 |
44 | 45 |
|
45 | 46 | - name: Set up Python |
@@ -74,10 +75,21 @@ jobs: |
74 | 75 | - name: Detect changed Clojure sources |
75 | 76 | if: github.event_name == 'push' |
76 | 77 | id: changed_clj |
| 78 | + env: |
| 79 | + GH_TOKEN: ${{ github.token }} |
| 80 | + REPO: ${{ github.repository }} |
77 | 81 | run: | |
78 | 82 | set -euo pipefail |
79 | 83 | git fetch origin main:refs/remotes/origin/main |
80 | | - 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' ' ') |
81 | 93 | if [ -z "$changed" ]; then |
82 | 94 | echo "No changed Clojure sources detected." |
83 | 95 | echo "files=" >> "$GITHUB_OUTPUT" |
|
0 commit comments