Skip to content

Commit 65a26b7

Browse files
mmckyclaude
andcommitted
Migrate translation workflows to @v0, adopt the review template, enable -W
Moves review and rebase off the exact `@v0.16.1` pin onto the floating `@v0` tag, per the pin policy settled in QuantEcon/project-translation#9, and aligns the review workflow with the upstream template in action-translation docs/user/tutorials/connect-existing.md. Two substantive changes beyond the pin: **Concurrency moves from workflow level to job level**, and `cancel-in-progress` from false to true. The previous comment argued that job-level `true` was unsafe because an 'automated' label event would cancel the in-flight review for 'action-translation' and then skip its own job via the filter, leaving no review at all. That was reasoned from the GitHub docs and never tested, and production disproved it: across roughly 15 live opportunities on lecture-intro.zh-cn the group was entered only after the `if` passed, the 'automated' event skipped without cancelling, and a review was posted every time. The stale rationale is replaced rather than left in place. **A `permissions` block is added** — v0.17.0's review dedupe deletes superseded comments, which requires `pull-requests: write`. The pin was two releases behind, which matters here: v0.18.0 carries the fix for a review-mode defect where a model response missing a criterion score became NaN and rendered as an automatic FAIL on otherwise clean PRs. See QuantEcon/action-translation#102. Separately, `ci.yml` gains `-W` on the notebook build. This repo's publish.yml already builds strict, so the PR gate was weaker than the publish gate — a corrupted sync could merge green and then break the published site. Coverage is 26 of 26 lectures with a `_toc.yml` identical to source, so there are no untranslated-lecture references for the flag to trip on. The strict build is the last line of defence against the silent-corruption class in QuantEcon/action-translation#118 and #119, both of which surfaced only because a downstream repo built with -n -W. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 444349c commit 65a26b7

3 files changed

Lines changed: 30 additions & 28 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ jobs:
6060
- name: Build HTML
6161
shell: bash -l {0}
6262
run: |
63-
jb build lectures --path-output ./ -n --keep-going
63+
jb build lectures --path-output ./ -n -W --keep-going
6464
- name: Upload Execution Reports
6565
uses: actions/upload-artifact@v7
6666
if: failure()

.github/workflows/rebase-translations.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434

3535
steps:
3636
- name: Rebase open translation PRs
37-
uses: QuantEcon/action-translation@v0.16.1
37+
uses: QuantEcon/action-translation@v0
3838
with:
3939
mode: rebase
4040
anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }}

.github/workflows/review-translations.yml

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,50 @@
11
# Review Translations — Quality check on translation PRs
22
# When a PR is opened/updated that carries the 'action-translation' label,
33
# 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.
47
name: Review Translations
58

69
on:
710
pull_request:
811
types: [opened, synchronize, labeled, reopened]
912

10-
# Serialise reviews per PR.
11-
#
12-
# The sync action creates the PR and then applies its labels in a separate call,
13-
# so a single sync fires `opened` plus one `labeled` event per label, all within
14-
# a couple of seconds. Every one of those starts a full review, and the action's
15-
# "update the existing comment, else create one" logic is a check-then-act with
16-
# no lock — concurrent runs all observe "no comment yet" and each create one.
17-
# See QuantEcon/lecture-python-programming.fr#6, which collected two review
18-
# comments this way, and QuantEcon/action-translation#96 for the upstream bug.
19-
#
20-
# cancel-in-progress is deliberately false. The labels are applied in one API
21-
# call, so event ordering is not guaranteed; if 'automated' arrived last it would
22-
# cancel the in-flight review for 'action-translation' and then skip its own job
23-
# via the filter below, leaving no review at all. Queuing instead means the first
24-
# run creates the comment and any later run updates it — one comment, always.
25-
concurrency:
26-
group: review-translations-${{ github.event.pull_request.number }}
27-
cancel-in-progress: false
28-
2913
jobs:
3014
review:
31-
# Require the 'action-translation' label, and — for `labeled` events — ignore
32-
# labels other than that one. Without the second clause the 'automated' label
33-
# fires a second, redundant review of the identical diff.
34-
if: >-
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: >
3519
contains(github.event.pull_request.labels.*.name, 'action-translation') &&
36-
(github.event.action != 'labeled' ||
37-
github.event.label.name == 'action-translation')
20+
(github.event.action != 'labeled' || github.event.label.name == 'action-translation')
3821
runs-on: ubuntu-latest
3922

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+
#
33+
# This supersedes the workflow-level `cancel-in-progress: false` previously used here,
34+
# whose rationale — that an 'automated' label event would cancel the real review and
35+
# then skip its own job, leaving none — was reasoned from the docs and never tested.
36+
# Production disproved it: across ~15 live opportunities on lecture-intro.zh-cn the
37+
# 'automated' event skipped without cancelling and a review was posted every time.
38+
concurrency:
39+
group: review-translations-${{ github.event.pull_request.number }}
40+
cancel-in-progress: true
41+
4042
steps:
4143
- uses: actions/checkout@v7
4244
with:
4345
fetch-depth: 2
4446

45-
- uses: QuantEcon/action-translation@v0.16.1
47+
- uses: QuantEcon/action-translation@v0
4648
with:
4749
mode: review
4850
source-repo: QuantEcon/lecture-python-programming

0 commit comments

Comments
 (0)