Skip to content

Commit 6ba6974

Browse files
committed
feat: Use git hash of latest change to src/schema
1 parent 9eeab01 commit 6ba6974

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

.github/workflows/publish_schema.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ jobs:
2727
runs-on: ubuntu-latest
2828
steps:
2929
- uses: actions/checkout@v4
30+
with:
31+
fetch-depth: 0
32+
filter: "blob:none"
3033
- uses: actions/setup-python@v5
3134
with:
3235
python-version: 3
@@ -36,7 +39,6 @@ jobs:
3639
git clean -fxd tools/schemacode
3740
- name: Checkout jsr-dist
3841
run: |
39-
git fetch --depth=1 origin jsr-dist
4042
git checkout -t origin/jsr-dist
4143
- name: Regenerate schema
4244
run: bst export > schema.json
@@ -59,8 +61,8 @@ jobs:
5961
jq ".version = \"$VERSION\"" jsr.json > tmp.json && mv tmp.json jsr.json
6062
else
6163
DENOVER=$( jq -r .version jsr.json )
62-
# Should switch to using the commit hash of the source repo?
63-
HASH=$( sha256sum schema.json | head -c 7 )
64+
# Get the reference of the latest commit to touch the schema directory
65+
HASH=$( git log -n 1 --pretty=%h $REF -- src/schema )
6466
if [[ $DENOVER =~ ^"$BASE".[0-9] ]]; then
6567
PREFIX=${DENOVER%+*}
6668
let SERIAL=1+${PREFIX#$BASE.}
@@ -70,6 +72,8 @@ jobs:
7072
VERSION="$BASE.$SERIAL+$HASH"
7173
fi
7274
echo VERSION=$VERSION | tee -a $GITHUB_ENV
75+
env:
76+
REF: ${{ github.ref }}
7377
- name: Check for changes, set version and commit
7478
run: |
7579
if ! git diff -s --exit-code; then

0 commit comments

Comments
 (0)