2121 type : string
2222 required : false
2323 default : " "
24+ base_ref :
25+ description : " TechAPI PR base branch (resolved from PR if omitted)"
26+ required : false
27+ base_sha :
28+ description : " TechAPI PR base SHA (resolved from PR if omitted)"
29+ required : false
2430
2531permissions :
2632 contents : read
3541 env :
3642 TECHAPI_COMMENT_TOKEN : ${{ secrets.TECHENGINEBOT_TOKEN || secrets.TECHAPI_TOKEN }}
3743 TECHAPI_PR_NUMBER : ${{ github.event.client_payload.pr_number || inputs.pr_number }}
44+ TECHAPI_BASE_REF : ${{ github.event.client_payload.base_ref || inputs.base_ref }}
45+ TECHAPI_BASE_SHA : ${{ github.event.client_payload.base_sha || inputs.base_sha }}
3846 TECHAPI_HEAD_SHA : ${{ github.event.client_payload.head_sha || inputs.head_sha }}
3947 TECHAPI_HEAD_REF : ${{ github.event.client_payload.head_ref || '' }}
4048 TECHAPI_PR_URL : ${{ github.event.client_payload.pr_url || inputs.pr_url }}
4553 - name : Checkout TechEngine
4654 uses : actions/checkout@v4
4755
56+ - name : Resolve actual PR base
57+ env :
58+ GH_TOKEN : ${{ env.TECHAPI_COMMENT_TOKEN || github.token }}
59+ shell : bash
60+ run : |
61+ set -euo pipefail
62+ if [ -z "$TECHAPI_BASE_REF" ] || [ -z "$TECHAPI_BASE_SHA" ]; then
63+ gh api "repos/GetTechAPI/TechAPI/pulls/$TECHAPI_PR_NUMBER" > pr-base.json
64+ TECHAPI_BASE_REF=$(jq -r '.base.ref' pr-base.json)
65+ TECHAPI_BASE_SHA=$(jq -r '.base.sha' pr-base.json)
66+ fi
67+ echo "TECHAPI_BASE_REF=$TECHAPI_BASE_REF" >> "$GITHUB_ENV"
68+ echo "TECHAPI_BASE_SHA=$TECHAPI_BASE_SHA" >> "$GITHUB_ENV"
69+
4870 - name : Checkout TechAPI PR head
4971 uses : actions/checkout@v4
5072 with :
@@ -57,16 +79,18 @@ jobs:
5779 uses : actions/checkout@v4
5880 with :
5981 repository : GetTechAPI/TechAPI
60- ref : develop
82+ ref : ${{ env.TECHAPI_BASE_SHA }}
6183 path : TechAPI-base
6284 fetch-depth : 0
6385
6486 - name : Pin PR base to the merge base
6587 shell : bash
6688 run : |
67- git -C TechAPI fetch --no-tags origin develop
68- base_sha="$(git -C TechAPI merge-base origin/develop HEAD)"
89+ git -C TechAPI fetch --no-tags origin "$TECHAPI_BASE_SHA"
90+ base_sha="$(git -C TechAPI merge-base "$TECHAPI_BASE_SHA" HEAD)"
91+ git -C TechAPI-base fetch --no-tags origin "$base_sha"
6992 git -C TechAPI-base checkout --detach "$base_sha"
93+ echo "TECHAPI_DIFF_BASE=$base_sha" >> "$GITHUB_ENV"
7094
7195 - uses : actions/setup-python@v6
7296 with :
@@ -165,15 +189,20 @@ jobs:
165189 PY
166190 )
167191
192+ python -m app.dump_check --base "$TECHAPI_BASE_SHA" --base-ref "$TECHAPI_BASE_REF" > dump-check.log 2>&1
193+ dump_status=$?
194+ cat dump-check.log >> validation.log
195+ python -m app.dump_check --base "$TECHAPI_BASE_SHA" --base-ref "$TECHAPI_BASE_REF" --scope-only > scope.txt
168196 sed -i '/_status=/d' validation.log
169197
170198 status="success"
171- if [ "${app_status:-1}" != "0" ] || [ "${integrity_status:-1}" != "0" ]; then
199+ if [ "${app_status:-1}" != "0" ] || [ "${integrity_status:-1}" != "0" ] || [ "${dump_status:-1}" != "0" ] ; then
172200 status="failure"
173201 fi
174202
175203 echo "status=$status" >> "$GITHUB_OUTPUT"
176204 echo "app_status=${app_status:-1}" >> "$GITHUB_OUTPUT"
205+ echo "dump_status=${dump_status:-1}" >> "$GITHUB_OUTPUT"
177206 echo "integrity_status=${integrity_status:-1}" >> "$GITHUB_OUTPUT"
178207
179208 - name : Build TechAPI homepage
@@ -210,16 +239,8 @@ jobs:
210239
211240 HEAD = Path("TechAPI/data")
212241 BASE = Path("TechAPI-base/data")
213- CATEGORIES = (
214- "brand",
215- "soc",
216- "smartphone",
217- "tablet",
218- "watch",
219- "pda",
220- "gpu",
221- "cpu",
222- )
242+ import os
243+ from app.categories import CATEGORIES
223244 MAX_WARNINGS = 20
224245
225246 def load_json(path: Path) -> dict[str, Any]:
@@ -250,7 +271,7 @@ jobs:
250271 "diff",
251272 "--name-status",
252273 "--no-renames",
253- "origin/develop ...HEAD",
274+ f"{os.environ['TECHAPI_BASE_SHA']} ...HEAD",
254275 "--",
255276 "data",
256277 ],
@@ -668,6 +689,8 @@ jobs:
668689 echo "<!-- techengine-pr-validation -->"
669690 echo "## TechEngine change review: ${result}"
670691 echo
692+ cat scope.txt
693+ echo
671694 echo "- PR: #${TECHAPI_PR_NUMBER}"
672695 echo "- Ref: \`${TECHAPI_HEAD_REF:-detached}\`"
673696 echo "- Commit: \`${short_sha}\`"
@@ -677,6 +700,7 @@ jobs:
677700 echo "| Check | Result |"
678701 echo "| --- | --- |"
679702 echo "| \`python -m app.validate\` | $([ "${{ steps.validate.outputs.app_status }}" = "0" ] && echo PASS || echo FAIL) |"
703+ echo "| Changed dump JSON and manifest/index counts | $([ "${{ steps.validate.outputs.dump_status }}" = "0" ] && echo PASS || echo FAIL) |"
680704 echo "| New hard integrity anomalies vs PR base | $([ "${{ steps.validate.outputs.integrity_status }}" = "0" ] && echo PASS || echo FAIL) |"
681705 if [ "${site_changed}" = "true" ]; then
682706 echo "| \`cd TechAPI/site && npm ci && npm run build\` | $([ "${site_build_status}" = "0" ] && echo PASS || echo FAIL) |"
@@ -693,6 +717,8 @@ jobs:
693717 echo "<!-- techengine-pr-validation-stats -->"
694718 echo "## TechEngine validation stats: ${result}"
695719 echo
720+ cat scope.txt
721+ echo
696722 echo "- PR: #${TECHAPI_PR_NUMBER}"
697723 echo "- Ref: \`${TECHAPI_HEAD_REF:-detached}\`"
698724 echo "- Commit: \`${short_sha}\`"
0 commit comments