Skip to content

Conversation

@lyzno1
Copy link
Contributor

@lyzno1 lyzno1 commented Jan 8, 2026

Summary

This PR fixes the translate-i18n-claude.yml workflow which fails when triggered by push events because claude-code-action doesn't support the push event type.

Error from failed run:

##[error]Prepare step failed with error: Unsupported event type: push

Failed run: https://github.com/langgenius/dify/actions/runs/20807450920

Solution

Split the workflow into two files using the repository_dispatch pattern:

1. trigger-i18n-sync.yml (NEW)

  • Listens for push events on main branch with changes to web/i18n/en-US/*.json
  • Detects changed files and generates git diff
  • Sends repository_dispatch event with payload containing:
    • changed_files: Space-separated list of changed file names
    • diff_base64: Base64-encoded git diff for context
    • sync_mode: Always "incremental" for push triggers

2. translate-i18n-claude.yml (MODIFIED)

  • Now listens for repository_dispatch (type: i18n-sync) instead of push
  • Decodes the base64 diff from the trigger workflow
  • Continues to support workflow_dispatch for manual triggers

Why repository_dispatch?

According to the claude-code-action source code, the supported events are:

  • pull_request / pull_request_target
  • pull_request_review / pull_request_review_comment
  • issue_comment / issues
  • workflow_dispatch
  • repository_dispatch
  • schedule
  • workflow_run

The push event is NOT supported.

Test Plan

  • Merge this PR to main
  • Make a change to any web/i18n/en-US/*.json file and push to main
  • Verify trigger-i18n-sync.yml workflow runs and sends repository_dispatch
  • Verify translate-i18n-claude.yml workflow is triggered and runs successfully
  • Test manual trigger via workflow_dispatch still works

Fixes #30743

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
Copilot AI review requested due to automatic review settings January 8, 2026 09:51
@gemini-code-assist
Copy link
Contributor

Note

Gemini is unable to generate a summary for this pull request due to the file types involved not being currently supported.

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. 🌊 feat:workflow Workflow related stuff. labels Jan 8, 2026
Copy link
Contributor

Copilot AI left a 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.

Copy link
Contributor

Copilot AI left a 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.

@lyzno1 lyzno1 marked this pull request as draft January 8, 2026 12:01
- 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
Copy link
Contributor

Copilot AI left a 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.

lyzno1 added 2 commits January 8, 2026 20:06
- Fall back to empty tree SHA when HEAD~1 doesn't exist (first commit)
- Exit with error when repository_dispatch payload missing changed_files
@lyzno1 lyzno1 marked this pull request as ready for review January 8, 2026 12:09
Copy link
Contributor

Copilot AI left a 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.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jan 8, 2026
@crazywoola crazywoola merged commit 7774a13 into main Jan 8, 2026
22 checks passed
@crazywoola crazywoola deleted the fix/i18n-workflow-push-event branch January 8, 2026 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🌊 feat:workflow Workflow related stuff. lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(ci): translate-i18n-claude workflow fails on push event - claude-code-action doesn't support push

3 participants