@@ -151,22 +151,23 @@ jobs:
151
151
run :
152
152
shell : bash
153
153
steps :
154
- - name : checkout-pr- branch
154
+ - name : checkout-branch
155
155
uses : actions/checkout@v4
156
156
with :
157
- path : ' pr'
158
-
159
- - name : checkout-develop-branch
160
- uses : actions/checkout@v4
161
- with :
162
- ref : develop
163
- path : ' develop'
164
-
157
+ ref : ${{ github.event.pull_request.head.ref }}
158
+ repository : ${{ github.event.pull_request.head.repo.full_name }}
159
+ fetch-depth : ' 0'
160
+
161
+ - name : git-config
162
+ run : |
163
+ cd $GITHUB_WORKSPACE
164
+ git config --global --add safe.directory $GITHUB_WORKSPACE
165
+
165
166
- name : install-depedencies
166
167
run : |
167
168
uv venv $GITHUB_WORKSPACE/.venv -p 3.11
168
169
source $GITHUB_WORKSPACE/.venv/bin/activate
169
- uv pip install -e "$GITHUB_WORKSPACE/pr "
170
+ uv pip install -e "$GITHUB_WORKSPACE"
170
171
171
172
- name : get-tidy3d-version
172
173
id : get-version
@@ -180,21 +181,24 @@ jobs:
180
181
run : |
181
182
echo "Regenerating schema to check if committed files are up-to-date..."
182
183
source $GITHUB_WORKSPACE/.venv/bin/activate
183
- python $GITHUB_WORKSPACE/pr/scripts/regenerate_schema.py
184
-
185
- echo "Checking for differences..."
186
- cd pr
187
- git diff --exit-code -- tidy3d/schemas
184
+ python $GITHUB_WORKSPACE/scripts/regenerate_schema.py
185
+
186
+ cd $GITHUB_WORKSPACE
187
+ echo "Checking for differences with HEAD commit..."
188
+ git status
189
+ git log
190
+ git diff HEAD --name-status --exit-code -- $GITHUB_WORKSPACE/schemas
188
191
echo "✅ Committed schema is up-to-date."
189
192
190
193
- name : run-schema-diff
191
194
id : schema-diff
192
195
run : |
196
+ set -e
193
197
# Use git diff to compare the two directories and get a list of changes
194
198
# The command exits with 0 if no changes, 1 if changes are found.
195
199
# We use '|| true' to prevent the workflow from stopping here on failure.
196
- cd $GITHUB_WORKSPACE/develop
197
- diff_output=$(git diff --no-index --name-status $GITHUB_WORKSPACE/develop/schemas $GITHUB_WORKSPACE/pr /schemas || true)
200
+ cd $GITHUB_WORKSPACE
201
+ diff_output=$(git diff origin/develop --name-status -- $GITHUB_WORKSPACE/schemas || true)
198
202
199
203
# Check if there are any changes
200
204
if [ -z "$diff_output" ]; then
@@ -204,7 +208,7 @@ jobs:
204
208
fi
205
209
206
210
# If there are changes, create a Markdown table
207
- echo "❌ Schema has changed! Please regenerate and commit the changes."
211
+ echo "❌ Schema has changed compared to develop ! Please regenerate and commit the changes."
208
212
echo "changed=true" >> $GITHUB_OUTPUT
209
213
210
214
# Write the report to the GitHub Step Summary
@@ -214,7 +218,7 @@ jobs:
214
218
215
219
echo "$diff_output" | while read -r line; do
216
220
status_code=$(echo "$line" | cut -f1)
217
- file_path=$(echo "$line" | cut -f2 | sed 's#pr/ tidy3d/schemas/##') # Clean up path
221
+ file_path=$(echo "$line" | cut -f2 | sed 's#tidy3d/schemas/##') # Clean up path
218
222
219
223
case $status_code in
220
224
"A") status="Added 🟢";;
@@ -229,6 +233,7 @@ jobs:
229
233
- name : verify-allowed-changes
230
234
if : steps.schema-diff.outputs.changed == 'true'
231
235
run : |
236
+ set -e
232
237
version="${{ steps.get-version.outputs.version }}"
233
238
if [[ "$version" == *rc* ]]; then
234
239
echo "✅ Passing: Schema changed on a release candidate version ($version), which is permitted."
0 commit comments