Skip to content

ci: sync translations only for PRs merged into main - #846

Merged
mmcky merged 2 commits into
mainfrom
sync-only-main-merges
Sep 14, 2026
Merged

mmcky merged 2 commits into
mainfrom
sync-only-main-merges

Conversation

@mmcky

@mmcky mmcky commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Adds branches: [main] to the pull_request trigger of every translation-sync workflow in this repo.

Why. pull_request: types: [closed] fires for a PR closed against any base branch, and the job's merged == true check does not look at the base either. On 2026-09-12 a theme migration merged into the long-lived jb2 branch fired the sync workflows and opened translation PRs in the target repos for content the published edition does not carry (those PRs have been closed). A merge into a work branch is not a publication event.

What changes. One line (plus a comment) per workflow: the trigger now requires the PR's base to be main. The \translate-resync comment path is unchanged here; the action itself now refuses a resync on a PR whose base is not the default branch, as of QuantEcon/action-translation v0.28.1 (see QuantEcon/action-translation#308). Until @v0 carries that release, this filter is the only guard, which is why it lands now rather than waiting.

When jb2 itself merges into main, that PR will trigger a sync that carries its accumulated changes in one run, as intended.

🤖 Generated with Claude Code

The sync workflows triggered on `pull_request: types: [closed]` with no
`branches:` filter, so a PR merged into any branch fired them. A merge into
the long-lived `jb2` branch opened translation PRs in every target repo for
content the published edition does not carry. Mirrors the template change
in QuantEcon/action-translation#308 (v0.28.1).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings September 14, 2026 03:24
@netlify

netlify Bot commented Sep 14, 2026

Copy link
Copy Markdown

Deploy Preview for taupe-gaufre-c4e660 ready!

Name Link
🔨 Latest commit b727281
🔍 Latest deploy log https://app.netlify.com/projects/taupe-gaufre-c4e660/deploys/6aa772312a2a6f000780282a
😎 Deploy Preview https://deploy-preview-846--taupe-gaufre-c4e660.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new base-branch filter does not apply to the issue_comment/\translate-resync trigger path, so non-main merged PRs can still initiate sync runs in a way that conflicts with the stated goal.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

This PR tightens the translation sync GitHub Actions trigger so that automatic translation-sync runs only happen for PRs merged into the main branch, preventing translation PRs from being opened based on merges into long-lived work/migration branches.

Changes:

  • Adds branches: [main] to the pull_request (closed) trigger for the Simplified Chinese translation sync workflow.
  • Adds an explanatory comment describing why the base-branch filter is needed.
File summaries
File Description
.github/workflows/sync-translations-zh-cn.yml Restricts the PR-merge trigger to base branch main and documents the rationale.
Review details

Suppressed comments (1)

.github/workflows/sync-translations-zh-cn.yml:16

  • The new branches: [main] filter only applies to the pull_request trigger. The workflow can still be triggered via issue_comment (\translate-resync) on a PR merged into a non-main base branch, which can still open translation PRs in target repos (especially while QuantEcon/action-translation@v0 does not yet include the base-branch refusal mentioned in the PR description). To fully meet the goal of “sync only for PRs merged into main”, add an equivalent base-branch gate for the issue_comment path (e.g., fetch the PR via the GitHub API and only run the sync step when base.ref == 'main'), or temporarily disable the resync comment trigger until @v0 carries v0.28.1+.
    branches: [main]
    paths:
      - 'lectures/**/*.md'
      - 'lectures/_toc.yml'
  issue_comment:
  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +9 to +11
# Only merges into main sync. Without this, a PR merged into any branch
# (a long-lived migration branch, say) opens translation PRs for content
# the published edition does not carry.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in b727281 — the comment now reads "Only PRs merged into main trigger a sync." followed by the same explanation. Same reword applied to the sibling PR QuantEcon/lecture-python.myst#1056.

@github-actions

github-actions Bot commented Sep 14, 2026

Copy link
Copy Markdown

@github-actions
github-actions Bot temporarily deployed to pull request September 14, 2026 03:31 Inactive
@github-actions
github-actions Bot temporarily deployed to pull request September 14, 2026 03:39 Inactive
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@github-actions
github-actions Bot temporarily deployed to pull request September 14, 2026 04:12 Inactive
@github-actions
github-actions Bot temporarily deployed to pull request September 14, 2026 04:12 Inactive
@mmcky
mmcky merged commit dca2c85 into main Sep 14, 2026
8 checks passed
@mmcky
mmcky deleted the sync-only-main-merges branch September 14, 2026 04:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants