ci: satisfy workflow shell lint

This commit is contained in:
chichuan
2026-08-10 11:14:23 +08:00
parent 46ae1c50fe
commit f3ecac1ad1
2 changed files with 12 additions and 8 deletions
+5 -4
View File
@@ -1370,7 +1370,7 @@ jobs:
if [ -z "$base_ref" ] || [ "$base_ref" = "0000000000000000000000000000000000000000" ]; then
base_ref="$(git rev-parse HEAD^)"
fi
candidate_ref="$(git rev-parse HEAD^{commit})"
candidate_ref="$(git rev-parse 'HEAD^{commit}')"
if [ "$GITHUB_EVENT_NAME" = "pull_request" ] && [ "$candidate_ref" != "$PR_HEAD_SHA" ]; then
echo "Compatibility checkout $candidate_ref does not match PR head $PR_HEAD_SHA" >&2
exit 1
@@ -1391,9 +1391,10 @@ jobs:
exit 1
fi
git rev-parse --verify "${stable_ref}^{commit}" >/dev/null
echo "COMPATIBILITY_BASE_REF=$base_ref" >> "$GITHUB_ENV"
echo "COMPATIBILITY_STABLE_REF=$stable_ref" >> "$GITHUB_ENV"
echo "COMPATIBILITY_CANDIDATE_REF=$candidate_ref" >> "$GITHUB_ENV"
printf '%s\n' \
"COMPATIBILITY_BASE_REF=$base_ref" \
"COMPATIBILITY_STABLE_REF=$stable_ref" \
"COMPATIBILITY_CANDIDATE_REF=$candidate_ref" >> "$GITHUB_ENV"
- name: Check historical commands, help, and complete CLI compatibility
if: ${{ needs.lint.outputs.changelog_only != 'true' && needs.lint.outputs.docs_only != 'true' && (needs.lint.outputs.full_suite == 'true' || needs.lint.outputs.interface_sensitive == 'true') }}
+7 -4
View File
@@ -412,16 +412,19 @@ func TestInterfaceIntegrityWorkflowContract(t *testing.T) {
}
}
for _, want := range []string{
`candidate_ref="$(git rev-parse HEAD^{commit})"`,
`candidate_ref="$(git rev-parse 'HEAD^{commit}')"`,
`[ "$candidate_ref" != "$PR_HEAD_SHA" ]`,
`echo "COMPATIBILITY_BASE_REF=$base_ref" >> "$GITHUB_ENV"`,
`echo "COMPATIBILITY_STABLE_REF=$stable_ref" >> "$GITHUB_ENV"`,
`echo "COMPATIBILITY_CANDIDATE_REF=$candidate_ref" >> "$GITHUB_ENV"`,
`"COMPATIBILITY_BASE_REF=$base_ref"`,
`"COMPATIBILITY_STABLE_REF=$stable_ref"`,
`"COMPATIBILITY_CANDIDATE_REF=$candidate_ref" >> "$GITHUB_ENV"`,
} {
if got := strings.Count(interfaceJob, want); got != 1 {
t.Errorf("Interface Integrity job contract %q count = %d, want exactly one definition", want, got)
}
}
if got := strings.Count(interfaceJob, `>> "$GITHUB_ENV"`); got != 1 {
t.Errorf("Interface Integrity job must append its compatibility refs to GITHUB_ENV once, got %d writes", got)
}
if strings.Count(interfaceJob, "make authoritative-interface-integrity") != 1 {
t.Errorf("Interface Integrity job must have exactly one compatibility decision seam")
}