Skip to content

Commit db0cde6

Browse files
mmckyclaude
andcommitted
Pin to @v0 and adopt the upstream review-workflow template
Two changes, both aligning this repo with action-translation's own documented conventions. Pin to @v0 on both workflows. The action's docs use @v0 throughout (19 occurrences against a single exact pin) and v0.17.0's notes recommend it directly. Exact pins were the deviation, and they cost us: v0.17.0's typography and review fixes sat unreachable behind nine stale pins while every sync kept stripping French non-breaking spaces. Development tempo is fast enough that manual bumps lag the releases that matter. The safety net is not the pin — sync output lands as a PR a human reviews before merge — and the floating tags are well maintained (v0 tracks v0.17.0; every vN.N tag tracks its latest patch). Adopt the upstream review template verbatim (docs/user/tutorials/ connect-existing.md), replacing the local variant from #7: - Add permissions: contents: read + pull-requests: write. v0.17.0's review dedupe deletes superseded comments, which needs pull-requests: write. Posting works today only because the default token happens to be permissive. - Move concurrency from workflow level to job level and flip cancel-in-progress to true. #7 argued true was unsafe, because an 'automated' labeled event would cancel the in-flight review then skip its own job, leaving none. That reasoning holds at workflow level, which is where #7 put it. At job level the group is entered only after the `if` passes, so a skipped job cancels nothing — and true is then better than false, superseding a stale in-flight review instead of queueing a redundant one. It also matches rebase-translations.yml, which has used job-level permissions + concurrency all along. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 14d0400 commit db0cde6

2 files changed

Lines changed: 22 additions & 26 deletions

File tree

.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: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,43 @@
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-
# That is how PR #6 collected two independent review comments.
18-
#
19-
# cancel-in-progress is deliberately false. The labels are applied in one API
20-
# call, so event ordering is not guaranteed; if 'automated' arrived last it would
21-
# cancel the in-flight review for 'action-translation' and then skip its own job
22-
# via the filter below, leaving no review at all. Queuing instead means the first
23-
# run creates the comment and any later run updates it — one comment, always.
24-
concurrency:
25-
group: review-translations-${{ github.event.pull_request.number }}
26-
cancel-in-progress: false
27-
2813
jobs:
2914
review:
30-
# Require the 'action-translation' label, and — for `labeled` events — ignore
31-
# labels other than that one. Without the second clause the 'automated' label
32-
# fires a second, redundant review of the identical diff.
33-
if: >-
15+
# Ignore `labeled` events for every other label: a sync applies its labels one call at a
16+
# time, and each one would otherwise start a full (billed) review of the same diff.
17+
if: >
3418
contains(github.event.pull_request.labels.*.name, 'action-translation') &&
35-
(github.event.action != 'labeled' ||
36-
github.event.label.name == 'action-translation')
19+
(github.event.action != 'labeled' || github.event.label.name == 'action-translation')
3720
runs-on: ubuntu-latest
3821

22+
# v0.17.0's review dedupe deletes superseded comments, which needs pull-requests: write.
23+
permissions:
24+
contents: read
25+
pull-requests: write
26+
27+
# One review per PR — supersede an in-flight review instead of running both.
28+
# Job-level (not workflow-level) on purpose: the group is entered only after the `if`
29+
# above has passed, so a `labeled` event for 'automated' skips out without cancelling
30+
# the real review. At workflow level it would cancel first and skip second, leaving none.
31+
concurrency:
32+
group: review-translations-${{ github.event.pull_request.number }}
33+
cancel-in-progress: true
34+
3935
steps:
4036
- uses: actions/checkout@v6
4137
with:
4238
fetch-depth: 2
4339

44-
- uses: QuantEcon/action-translation@v0.16.1
40+
- uses: QuantEcon/action-translation@v0
4541
with:
4642
mode: review
4743
source-repo: QuantEcon/lecture-python-programming

0 commit comments

Comments
 (0)