Skip to content

Commit 7ee24f5

Browse files
committed
ci: trigger frontend export check on push (not just PRs)
1 parent ad7d7e8 commit 7ee24f5

1 file changed

Lines changed: 19 additions & 3 deletions

File tree

.github/workflows/require_frontend_export.yml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ on:
77
- "frontend/**"
88
- "scripts/export_frontend.sh"
99
- "src/hyperview/server/static/**"
10+
push:
11+
paths:
12+
- "frontend/**"
13+
- "scripts/export_frontend.sh"
14+
- "src/hyperview/server/static/**"
1015

1116
jobs:
1217
require-frontend-export:
@@ -17,14 +22,25 @@ jobs:
1722
uses: actions/checkout@v4
1823
with:
1924
fetch-depth: 0
20-
ref: ${{ github.event.pull_request.head.sha }}
2125

2226
- name: Verify static export updated when frontend changes
2327
run: |
2428
set -euo pipefail
2529
26-
base_sha="${{ github.event.pull_request.base.sha }}"
27-
head_sha="${{ github.event.pull_request.head.sha }}"
30+
# Determine base and head SHAs based on event type
31+
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
32+
base_sha="${{ github.event.pull_request.base.sha }}"
33+
head_sha="${{ github.event.pull_request.head.sha }}"
34+
else
35+
# For push events, compare with the previous commit
36+
head_sha="${{ github.sha }}"
37+
base_sha="${{ github.event.before }}"
38+
# Handle initial push (no previous commit)
39+
if [[ "$base_sha" == "0000000000000000000000000000000000000000" ]]; then
40+
echo "Initial push - skipping check"
41+
exit 0
42+
fi
43+
fi
2844
2945
changed_files="$(git diff --name-only "$base_sha" "$head_sha")"
3046

0 commit comments

Comments
 (0)