-
Notifications
You must be signed in to change notification settings - Fork 19.5k
fix(ci): use repository_dispatch for i18n sync workflow #30744
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
claude-code-action doesn't support push events directly. This change splits the workflow into two: 1. trigger-i18n-sync.yml: Listens for push events on main branch, detects i18n file changes, and sends repository_dispatch event 2. translate-i18n-claude.yml: Now listens for repository_dispatch instead of push, which is supported by claude-code-action Fixes #30743
|
Note Gemini is unable to generate a summary for this pull request due to the file types involved not being currently supported. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes the i18n synchronization workflow by addressing an incompatibility between the claude-code-action and push events. The solution splits the workflow into two parts using the repository_dispatch pattern to bridge push events to a supported event type.
Key changes:
- Created a new trigger workflow that listens for push events and sends repository_dispatch events with file change context
- Modified the translation workflow to receive repository_dispatch events instead of push events
- Maintained backward compatibility with manual workflow_dispatch triggers
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
.github/workflows/trigger-i18n-sync.yml |
New workflow that detects i18n file changes on push and triggers repository_dispatch with change context |
.github/workflows/translate-i18n-claude.yml |
Modified to receive repository_dispatch instead of push events, with updated logic to handle the new event payload |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Quote SHA variables in git diff commands for safety - Use portable base64 encoding (base64 | tr -d '\n') - Standardize diff truncation to 50KB in both workflows - Add better error handling for base64 decode failures - Add warning for missing payload fields in repository_dispatch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Fall back to empty tree SHA when HEAD~1 doesn't exist (first commit) - Exit with error when repository_dispatch payload missing changed_files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
This PR fixes the
translate-i18n-claude.ymlworkflow which fails when triggered by push events becauseclaude-code-actiondoesn't support thepushevent type.Error from failed run:
Failed run: https://github.com/langgenius/dify/actions/runs/20807450920
Solution
Split the workflow into two files using the
repository_dispatchpattern:1.
trigger-i18n-sync.yml(NEW)pushevents on main branch with changes toweb/i18n/en-US/*.jsonrepository_dispatchevent with payload containing:changed_files: Space-separated list of changed file namesdiff_base64: Base64-encoded git diff for contextsync_mode: Always "incremental" for push triggers2.
translate-i18n-claude.yml(MODIFIED)repository_dispatch(type:i18n-sync) instead ofpushworkflow_dispatchfor manual triggersWhy
repository_dispatch?According to the claude-code-action source code, the supported events are:
pull_request/pull_request_targetpull_request_review/pull_request_review_commentissue_comment/issuesworkflow_dispatchrepository_dispatch✓scheduleworkflow_runThe
pushevent is NOT supported.Test Plan
web/i18n/en-US/*.jsonfile and push to maintrigger-i18n-sync.ymlworkflow runs and sendsrepository_dispatchtranslate-i18n-claude.ymlworkflow is triggered and runs successfullyworkflow_dispatchstill worksFixes #30743