Files
market/.github/workflows/i18n-validate.yml
T
yige 39370aba29 fix(skill): make skill initialization safe on Windows pipes (#421)
## Summary
- Keep the caller's stdout encoding and escape only characters it cannot
represent. This prevents the normal skill initializer command from
aborting on legacy-encoded Windows pipes and preserves Unicode output on
UTF-8 streams.
- Write all generated skill templates as UTF-8 so the localized content
does not depend on the machine locale.
- Exercise the actual CLI with CP1252 and UTF-8 output in the i18n
validation workflow, including a non-ASCII destination, generated
localized files, and duplicate-directory errors.

## Validation
- Reproduced UnicodeEncodeError with the unmodified CLI and CP1252
stdout; both focused regression tests pass on the change.
- Catalog and i18n validation passed with zero errors; translation
freshness and `git diff --check` passed.
- No new dependencies or metadata changes. A native installed-app
confirmation still belongs to the consuming product after syncing the
bundled Market seed.
2026-12-02 11:39:40 +08:00

103 lines
3.8 KiB
YAML

name: i18n Validate
on:
pull_request:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: read
jobs:
validate:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Detect relevant changes
id: changes
env:
EVENT_NAME: ${{ github.event_name }}
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
PUSH_BEFORE: ${{ github.event.before }}
PUSH_AFTER: ${{ github.event.after }}
run: |
set -e
case "$EVENT_NAME" in
pull_request)
git fetch --no-tags --depth=1 origin "$BASE_SHA" 2>/dev/null || true
range="${BASE_SHA}...${HEAD_SHA}"
;;
push)
if [ -n "$PUSH_BEFORE" ] && [ "$PUSH_BEFORE" != "0000000000000000000000000000000000000000" ]; then
range="${PUSH_BEFORE}...${PUSH_AFTER}"
else
# initial push or unknown before — assume relevant
echo "relevant=true" >> "$GITHUB_OUTPUT"
exit 0
fi
;;
*)
echo "relevant=true" >> "$GITHUB_OUTPUT"
exit 0
;;
esac
changed=$(git diff --name-only "$range" || true)
if echo "$changed" | grep -qE '^(skills/|agents/|teams/|schemas/|manifest\.json$|categories\.json$|scripts/i18n/|scripts/catalog/|scripts/office/|scripts/gen-collection-children\.py$|\.github/workflows/auto-request-copilot-review\.yml$)'; then
echo "relevant=true" >> "$GITHUB_OUTPUT"
else
echo "relevant=false" >> "$GITHUB_OUTPUT"
fi
- name: Install uv
if: steps.changes.outputs.relevant == 'true'
uses: astral-sh/setup-uv@v3
- name: Run validator unit tests
if: steps.changes.outputs.relevant == 'true'
run: uv run --quiet scripts/i18n/test_validate_i18n.py
- name: Run skill-creator CLI encoding tests
if: steps.changes.outputs.relevant == 'true'
run: python3 -B scripts/catalog/test_skill_creator_cli.py
- name: Run Office launcher contract tests
if: steps.changes.outputs.relevant == 'true'
run: python3 -B scripts/office/test_runtime_launcher.py
- name: Run catalog validator unit tests
if: steps.changes.outputs.relevant == 'true'
run: |
uv run --quiet scripts/catalog/test_validate_catalog_metadata.py
uv run --quiet scripts/catalog/test_collection_generator.py
uv run --quiet scripts/catalog/test_check_upstream_health.py
uv run --quiet scripts/catalog/test_propose_upstream_updates.py
uv run --quiet scripts/catalog/test_audit_skill_update.py
uv run --quiet --with pytest --with pyyaml --with jsonschema python -m pytest scripts/catalog/test_tracked_updates.py -q
uv run --quiet scripts/catalog/test_review_workflow.py
- name: Validate catalog metadata
if: steps.changes.outputs.relevant == 'true'
run: uv run --quiet scripts/catalog/validate_catalog_metadata.py --require-complete
- name: Validate i18n
if: steps.changes.outputs.relevant == 'true'
run: uv run --quiet scripts/i18n/validate-i18n.py
- name: Check for stale translations
if: steps.changes.outputs.relevant == 'true'
run: uv run --quiet scripts/i18n/translate.py --check
- name: Check generated collection children
if: steps.changes.outputs.relevant == 'true'
run: uv run --quiet scripts/gen-collection-children.py --check
- name: Skip notice
if: steps.changes.outputs.relevant != 'true'
run: echo "No i18n-relevant changes; validation skipped."