Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix(i18n): pin sync source and link originating PR (#42896)

yyha1622aea285a
diff --git a/.github/workflows/translate-i18n-claude.yml b/.github/workflows/translate-i18n-claude.yml
index dd71eeb52eb..c3755cb9720 100644
--- a/.github/workflows/translate-i18n-claude.yml
+++ b/.github/workflows/translate-i18n-claude.yml
@@ -47,6 +47,7 @@ jobs:
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
+ ref: ${{ github.event.client_payload.head_sha || github.sha }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Configure Git
@@ -285,6 +286,7 @@ jobs:
BASE_SHA: ${{ steps.context.outputs.BASE_SHA }}
HEAD_SHA: ${{ steps.context.outputs.HEAD_SHA }}
REPO_NAME: ${{ github.repository }}
+ EVENT_NAME: ${{ github.event_name }}
shell: bash
run: |
PR_BODY_FILE=/tmp/i18n-pr-body.md
@@ -295,6 +297,7 @@ jobs:
export LANG_COUNT
node <<'NODE' > "$PR_BODY_FILE"
+ const { execFileSync } = require('node:child_process')
const fs = require('node:fs')
const changesPath = '/tmp/i18n-changes.json'
@@ -303,7 +306,25 @@ jobs:
: { changes: {} }
const filesInScope = (process.env.FILES_IN_SCOPE || '').split(/\s+/).filter(Boolean)
+ const sourceCommit = process.env.HEAD_SHA
+ let sourcePr
+ if (process.env.EVENT_NAME === 'repository_dispatch') {
+ try {
+ const pulls = JSON.parse(execFileSync('gh', [
+ 'api', `repos/${process.env.REPO_NAME}/commits/${sourceCommit}/pulls`,
+ ], { encoding: 'utf8' }))
+ sourcePr = pulls.find(pr => pr.merged_at && pr.merge_commit_sha === sourceCommit)
+ } catch (error) {
+ console.error(`Could not resolve source PR: ${error.message}`)
+ }
+ }
+
const lines = [
+ '## Source',
+ '',
+ ...(sourcePr ? [`- **PR**: [#${sourcePr.number}](${sourcePr.html_url})`] : []),
+ `- **Commit**: [\`${sourceCommit.slice(0, 12)}\`](https://github.com/${process.env.REPO_NAME}/commit/${sourceCommit})`,
+ '',
'## Summary',
'',
`- **Files synced**: \`${process.env.FILES_IN_SCOPE || '<none>'}\``,