fix(ci): validate the porting record after force pushes

Fall back to the default branch when the event baseline is absent from the checkout. Preserve available comparison commits and always run the validator.

Validation: the actual workflow shell passes valid, empty, new-branch and unavailable force-push baseline cases.
This commit is contained in:
bluseliu50
2026-11-04 01:20:15 +08:00
Unverified
parent b4dafe0618
commit 82b847c4ac
+2 -1
View File
@@ -28,7 +28,8 @@ jobs:
BASE: ${{ github.event.pull_request.base.sha || github.event.before }}
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
run: |
if [[ -z "$BASE" || "$BASE" =~ ^0+$ ]]; then
if [[ -z "$BASE" || "$BASE" =~ ^0+$ ]] ||
! git -C device cat-file -e "${BASE}^{commit}" 2>/dev/null; then
BASE="refs/remotes/origin/$DEFAULT_BRANCH"
fi
python3 tools/scripts/porting-record.py check --device device --base "$BASE"