mirror of
https://git.openapi.site/https://github.com/desirecore/market.git
synced 2026-12-05 11:59:24 +08:00
fix(ci): switch pull_request_target workflows to pull_request (#432)
GitHub now restricts `pull_request_target` on public repositories by default, causing `i18n Auto-Translate` (required `translate` check) and `Auto-request Copilot review` to fail immediately with `startup_failure`. ### Changes - **`.github/workflows/i18n-translate.yml`**: - Switch trigger from `pull_request_target` to `pull_request`. - Explicitly check out `github.base_ref` on `pull_request` and keep the data-only overlay model (`skills/`, `manifest.json`, `categories.json`, symlink removal) so untrusted PR scripts are never executed. - Gate auto-translate, push, PR comment, and failure-label steps to same-repo PRs (`github.event.pull_request.head.repo.full_name == github.repository`) so fork PRs (which receive read-only tokens under `pull_request`) run `translate.py --check` and fail cleanly with local translation instructions instead of crashing with 403. - **`.github/workflows/auto-request-copilot-review.yml`**: - Switch trigger from `pull_request_target` to `pull_request` (keeping `opened`, `reopened`, `ready_for_review`). - Guard the `request` job to non-draft same-repo PRs so fork PRs do not fail with 403. - **`scripts/catalog/test_review_workflow.py`**: - Update assertions to require `pull_request` (and reject `pull_request_target`) plus verify the non-draft & same-repo job guard while preserving all no-checkout/no-code-execution assertions. ### Verification - `uv run --offline --quiet scripts/catalog/test_review_workflow.py` — passed - `pytest scripts/catalog/test_tracked_updates.py -q` — 64 passed - `uv run --offline --quiet scripts/i18n/validate-i18n.py` — passed - `uv run --offline --quiet scripts/catalog/validate_catalog_metadata.py --require-complete` — 0 errors
This commit is contained in:
1 parent
871a57074a
commit
f6d1eccf70
3 files changed
+40
-27
No files matched your search
@@ -1,8 +1,9 @@
|
||||
name: Auto-request Copilot review
|
||||
|
||||
on:
|
||||
# 仅操作主仓 PR 元数据;本流程不检出或执行 PR 代码。
|
||||
pull_request_target:
|
||||
# 仅对主仓非草稿 PR 操作元数据;本流程不检出或执行 PR 代码。
|
||||
# GitHub 公仓默认禁用 pull_request_target,改用 pull_request 并仅对同仓 PR 执行写操作。
|
||||
pull_request:
|
||||
types: [opened, reopened, ready_for_review]
|
||||
|
||||
permissions:
|
||||
@@ -10,7 +11,7 @@ permissions:
|
||||
|
||||
jobs:
|
||||
request:
|
||||
if: github.event.pull_request.draft == false
|
||||
if: github.event.pull_request.draft == false && github.event.pull_request.head.repo.full_name == github.repository
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 2
|
||||
steps:
|
||||
|
||||
Reference in new issue
Block a user