Skip to content

Commit 7a176b6

Browse files
mmckyclaude
andcommitted
Add translation review and rebase workflows
Copied from lecture-intro.zh-cn (Track A wiring, includes the fr-pattern review guards and v0.17.0 review dedupe) with source-repo pointed at QuantEcon/lecture-python.myst. Requires the ANTHROPIC_API_KEY org secret to be extended to this repo. Part of Phase 0 Track B, QuantEcon/lecture-python.myst#947. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 753de32 commit 7a176b6

2 files changed

Lines changed: 90 additions & 0 deletions

File tree

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Rebase Translation PRs
2+
#
3+
# Install this workflow in the TARGET (translated) repository.
4+
# When a translation-sync PR is merged, this workflow automatically
5+
# rebases other open translation-sync PRs against the updated main branch.
6+
#
7+
# This eliminates merge conflicts caused by multiple upstream PRs
8+
# modifying the same files. See: https://github.com/QuantEcon/action-translation/issues/63
9+
#
10+
# Place this file at: .github/workflows/rebase-translations.yml
11+
12+
name: Rebase Translation PRs
13+
14+
on:
15+
pull_request:
16+
types: [closed]
17+
18+
jobs:
19+
rebase:
20+
# Only run when a translation-sync PR is merged
21+
if: >
22+
github.event.pull_request.merged == true &&
23+
startsWith(github.event.pull_request.head.ref, 'translation-sync-')
24+
runs-on: ubuntu-latest
25+
26+
permissions:
27+
contents: write
28+
pull-requests: write
29+
30+
# Prevent concurrent rebases from overlapping
31+
concurrency:
32+
group: rebase-translations
33+
cancel-in-progress: false
34+
35+
steps:
36+
- name: Rebase open translation PRs
37+
uses: QuantEcon/action-translation@v0
38+
with:
39+
mode: rebase
40+
anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }}
41+
github-token: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Review Translations — Quality check on translation PRs
2+
# When a PR is opened/updated that carries the 'action-translation' label,
3+
# this workflow runs a quality review and posts a comment.
4+
#
5+
# Mirrors the upstream template in action-translation
6+
# docs/user/tutorials/connect-existing.md — keep it in step with that.
7+
name: Review Translations
8+
9+
on:
10+
pull_request:
11+
types: [opened, synchronize, labeled, reopened]
12+
13+
jobs:
14+
review:
15+
# Ignore `labeled` events for every other label: a sync adds its labels in a single
16+
# addLabels call, but GitHub emits one `labeled` event per label, and each would
17+
# otherwise start a full (billed) review of the same diff.
18+
if: >
19+
contains(github.event.pull_request.labels.*.name, 'action-translation') &&
20+
(github.event.action != 'labeled' || github.event.label.name == 'action-translation')
21+
runs-on: ubuntu-latest
22+
23+
# v0.17.0's review dedupe deletes superseded comments, which needs pull-requests: write.
24+
permissions:
25+
contents: read
26+
pull-requests: write
27+
28+
# One review per PR — supersede an in-flight review instead of running both.
29+
# Job-level (not workflow-level) on purpose: the group is entered only after the `if`
30+
# above has passed, so a `labeled` event for 'automated' skips out without cancelling
31+
# the real review. At workflow level it would cancel first and skip second, leaving none.
32+
concurrency:
33+
group: review-translations-${{ github.event.pull_request.number }}
34+
cancel-in-progress: true
35+
36+
steps:
37+
- uses: actions/checkout@v7
38+
with:
39+
fetch-depth: 2
40+
41+
- uses: QuantEcon/action-translation@v0
42+
with:
43+
mode: review
44+
source-repo: QuantEcon/lecture-python.myst
45+
source-language: en
46+
target-language: zh-cn
47+
docs-folder: lectures
48+
anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }}
49+
github-token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)