Skip to content

Commit 336c75a

Browse files
authored
Update validate.yml (#1)
1 parent 18c113c commit 336c75a

File tree

1 file changed

+12
-18
lines changed

1 file changed

+12
-18
lines changed

.github/workflows/validate.yml

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ name: Validate Schemas
22

33
on:
44
push:
5-
branches: [ "main" ]
5+
branches: ["main"]
6+
tags-ignore: ["*"] # <- do not run this workflow for tags
67
pull_request:
7-
branches: [ "main" ]
8+
branches: ["main"]
89
workflow_dispatch:
910

10-
# Cancel older runs of the same branch/PR
1111
concurrency:
1212
group: ${{ github.workflow }}-${{ github.ref }}
1313
cancel-in-progress: true
@@ -21,15 +21,15 @@ jobs:
2121
runs-on: ubuntu-latest
2222
env:
2323
FORCE_COLOR: "1"
24-
2524
steps:
2625
- name: Checkout repository
2726
uses: actions/checkout@v4
2827
with:
2928
fetch-depth: 0
29+
# Always checkout the exact SHA for PRs/pushes
30+
ref: ${{ github.sha }}
3031

31-
# Ensure runner uses LF and does not rewrite files
32-
- name: Normalize git on runner
32+
- name: Normalize git on runner (LF)
3333
run: |
3434
git config --global core.autocrlf false
3535
git config --global core.eol lf
@@ -49,25 +49,19 @@ jobs:
4949
- name: Validate examples
5050
run: npm run validate:examples
5151

52+
# Regenerate checksums only on branches (not tags)
5253
- name: Generate checksums
54+
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
5355
run: node scripts/generate-checksums.mjs schemas/v1.0.0 checksums.txt
5456

55-
# Helpful debug if drift occurs
56-
- name: Debug checksum drift
57-
if: always()
58-
run: |
59-
echo "::group::git status"
60-
git status --porcelain || true
61-
echo "::endgroup::"
62-
echo "::group::diff checksums.txt"
63-
git diff -- checksums.txt || true
64-
echo "::endgroup::"
65-
57+
# Compare checksums only on branches (not tags)
6658
- name: Verify checksums are current
59+
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
6760
run: git diff --exit-code checksums.txt
6861

62+
# Upload artifact on failure to help debug
6963
- name: Upload checksums artifact (for debugging)
70-
if: failure() || cancelled()
64+
if: always()
7165
uses: actions/upload-artifact@v4
7266
with:
7367
name: checksums.txt

0 commit comments

Comments
 (0)