From 75bccfabdba30e40ac387e18663057a8f2cb9942 Mon Sep 17 00:00:00 2001 From: Gu Date: Sat, 23 Aug 2025 17:09:59 +0800 Subject: [PATCH 1/3] fix: enable manual workflow_dispatch for execute documentation sync - Update execute-sync job condition to handle both workflow_run and workflow_dispatch events - Fixes issue where manual triggers would skip all jobs due to missing workflow_run context --- .github/workflows/sync_docs_execute.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/sync_docs_execute.yml b/.github/workflows/sync_docs_execute.yml index d14d78e1c..4c2be5304 100644 --- a/.github/workflows/sync_docs_execute.yml +++ b/.github/workflows/sync_docs_execute.yml @@ -21,7 +21,9 @@ permissions: jobs: execute-sync: runs-on: ubuntu-latest - if: github.event.workflow_run.conclusion == 'success' + if: | + (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') || + github.event_name == 'workflow_dispatch' steps: - name: Check workflow source id: check-source From 3f006c15a029ccbd5583726da8e3e7062856fb1b Mon Sep 17 00:00:00 2001 From: Gu Date: Sat, 23 Aug 2025 17:26:58 +0800 Subject: [PATCH 2/3] fix: handle workflow_dispatch in source check step - Add bypass logic for manual workflow_dispatch triggers on revamp branch - Prevents workflow from skipping when manually triggered for testing - Maintains security checks for workflow_run events --- .github/workflows/sync_docs_execute.yml | 53 ++++++++++++++++--------- 1 file changed, 34 insertions(+), 19 deletions(-) diff --git a/.github/workflows/sync_docs_execute.yml b/.github/workflows/sync_docs_execute.yml index 4c2be5304..50743c2f7 100644 --- a/.github/workflows/sync_docs_execute.yml +++ b/.github/workflows/sync_docs_execute.yml @@ -29,26 +29,41 @@ jobs: id: check-source run: | echo "Checking workflow source..." - echo "Event: ${{ github.event.workflow_run.event }}" - echo "Repository: ${{ github.event.workflow_run.repository.full_name }}" - echo "Head Repository: ${{ github.event.workflow_run.head_repository.full_name }}" - echo "Head Branch: ${{ github.event.workflow_run.head_branch }}" - - # Security check: Only process PRs from the same repository or trusted forks - if [[ "${{ github.event.workflow_run.event }}" != "pull_request" ]]; then - echo "Not a pull request event, skipping" - echo "should_process=false" >> $GITHUB_OUTPUT - exit 0 - fi - - # Check if this is from a fork - IS_FORK="false" - if [[ "${{ github.event.workflow_run.repository.full_name }}" != "${{ github.event.workflow_run.head_repository.full_name }}" ]]; then - IS_FORK="true" + echo "Event name: ${{ github.event_name }}" + + if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then + # Manual trigger - bypass source checks for revamp branch + if [[ "${{ github.ref }}" == "refs/heads/revamp" ]]; then + echo "Manual workflow_dispatch on revamp branch - proceeding" + echo "is_fork=false" >> $GITHUB_OUTPUT + echo "should_process=true" >> $GITHUB_OUTPUT + else + echo "Manual workflow_dispatch not on revamp branch - skipping" + echo "should_process=false" >> $GITHUB_OUTPUT + fi + else + # workflow_run event - use existing logic + echo "Event: ${{ github.event.workflow_run.event }}" + echo "Repository: ${{ github.event.workflow_run.repository.full_name }}" + echo "Head Repository: ${{ github.event.workflow_run.head_repository.full_name }}" + echo "Head Branch: ${{ github.event.workflow_run.head_branch }}" + + # Security check: Only process PRs from the same repository or trusted forks + if [[ "${{ github.event.workflow_run.event }}" != "pull_request" ]]; then + echo "Not a pull request event, skipping" + echo "should_process=false" >> $GITHUB_OUTPUT + exit 0 + fi + + # Check if this is from a fork + IS_FORK="false" + if [[ "${{ github.event.workflow_run.repository.full_name }}" != "${{ github.event.workflow_run.head_repository.full_name }}" ]]; then + IS_FORK="true" + fi + + echo "is_fork=$IS_FORK" >> $GITHUB_OUTPUT + echo "should_process=true" >> $GITHUB_OUTPUT fi - - echo "is_fork=$IS_FORK" >> $GITHUB_OUTPUT - echo "should_process=true" >> $GITHUB_OUTPUT - name: Download analysis artifacts if: steps.check-source.outputs.should_process == 'true' From 8ada06fe123e90ab22321e2deee29350fd1f00b0 Mon Sep 17 00:00:00 2001 From: Gu Date: Sat, 23 Aug 2025 17:30:25 +0800 Subject: [PATCH 3/3] test: fresh workflow validation with complete fixes - Add new test documentation to validate fixed translation workflow - Updated docs.json navigation structure - Tests both automatic and manual workflow triggers --- docs.json | 1 + .../pages/getting-started/fresh-test.mdx | 75 +++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 en/documentation/pages/getting-started/fresh-test.mdx diff --git a/docs.json b/docs.json index 3f873e80a..9f92b844f 100644 --- a/docs.json +++ b/docs.json @@ -32,6 +32,7 @@ "en/documentation/pages/getting-started/quick-start", "en/documentation/pages/getting-started/key-concepts", "en/documentation/pages/getting-started/faq", + "en/documentation/pages/getting-started/fresh-test", "en/documentation/pages/getting-started/test-internal" ] }, diff --git a/en/documentation/pages/getting-started/fresh-test.mdx b/en/documentation/pages/getting-started/fresh-test.mdx new file mode 100644 index 000000000..198a441a4 --- /dev/null +++ b/en/documentation/pages/getting-started/fresh-test.mdx @@ -0,0 +1,75 @@ +--- +title: "Fresh Workflow Test" +sidebarTitle: "Fresh Test" +description: "Testing the complete fixed translation workflow" +--- + +# Fresh Workflow Test + +This is a fresh test document to validate the completely fixed automatic translation workflow. + +## What's Been Fixed + +1. **Job Condition**: Now handles both `workflow_run` and `workflow_dispatch` events +2. **Source Check**: Properly bypasses checks for manual `workflow_dispatch` on revamp branch +3. **Workflow Triggering**: Should now work for both automatic and manual scenarios + +## Test Content + +### Basic Workflow Features + +The translation system should handle: +- Standard markdown content +- Code blocks with syntax highlighting +- MDX components and notes +- Tables and lists +- Links and references + +### Sample Code + +```javascript +// Example: Dify API integration +const difyClient = { + baseURL: 'https://api.dify.ai/v1', + apiKey: 'your-api-key', + + async callWorkflow(workflowId, inputs) { + const response = await fetch(`${this.baseURL}/workflows/${workflowId}/run`, { + method: 'POST', + headers: { + 'Authorization': `Bearer ${this.apiKey}`, + 'Content-Type': 'application/json' + }, + body: JSON.stringify({ + inputs, + response_mode: 'blocking' + }) + }); + + return response.json(); + } +}; +``` + +### Features Table + +| Component | English | Chinese | Japanese | Status | +|-----------|---------|---------|----------|--------| +| Documentation | ✅ | 🔄 Auto | 🔄 Auto | Testing | +| Navigation | ✅ | 🔄 Auto | 🔄 Auto | Testing | +| Workflow | ✅ | N/A | N/A | Fixed | + +### Important Note + + +This fresh test validates that all workflow fixes are working correctly. The system should automatically translate this content and create a corresponding translation PR. + + +## Expected Results + +1. **Analyze workflow** detects English-only changes +2. **Execute workflow** runs without skipping steps +3. **Translation PR** is created automatically +4. **Manual trigger** also works for debugging + +This test confirms the complete end-to-end functionality. \ No newline at end of file