From d6db937ac5033dbcc4fa778fe2b8d3523c2d088d Mon Sep 17 00:00:00 2001 From: Archer <545436317@qq.com> Date: Mon, 16 Mar 2026 19:49:53 +0800 Subject: [PATCH] V4.14.9 dev (#6568) * action * action * rename action * action * action --- .../{deploy/docs.yml => build-docs.yml} | 0 .../{deploy/fastgpt.yml => build-fastgpt.yml} | 0 ...etplace-image.yml => build-marketplace.yml} | 0 .../mcp-server.yml => build-mcp-server.yml} | 0 .../{deploy/sandbox.yml => build-sandbox.yml} | 0 .../docs-build.yml => preview-docs-build.yml} | 10 ---------- .../docs-push.yml => preview-docs-push.yml} | 18 ++++++++++++++---- ...gpt-build.yml => preview-fastgpt-build.yml} | 10 ---------- ...stgpt-push.yml => preview-fastgpt-push.yml} | 18 ++++++++++++++---- .../fastgpt-test.yaml => test-fastgpt.yaml} | 0 .../sandbox-test.yaml => test-sandbox.yaml} | 0 11 files changed, 28 insertions(+), 28 deletions(-) rename .github/workflows/{deploy/docs.yml => build-docs.yml} (100%) rename .github/workflows/{deploy/fastgpt.yml => build-fastgpt.yml} (100%) rename .github/workflows/{deploy/marketplace-image.yml => build-marketplace.yml} (100%) rename .github/workflows/{deploy/mcp-server.yml => build-mcp-server.yml} (100%) rename .github/workflows/{deploy/sandbox.yml => build-sandbox.yml} (100%) rename .github/workflows/{preview/docs-build.yml => preview-docs-build.yml} (86%) rename .github/workflows/{preview/docs-push.yml => preview-docs-push.yml} (86%) rename .github/workflows/{preview/fastgpt-build.yml => preview-fastgpt-build.yml} (91%) rename .github/workflows/{preview/fastgpt-push.yml => preview-fastgpt-push.yml} (86%) rename .github/workflows/{test/fastgpt-test.yaml => test-fastgpt.yaml} (100%) rename .github/workflows/{test/sandbox-test.yaml => test-sandbox.yaml} (100%) diff --git a/.github/workflows/deploy/docs.yml b/.github/workflows/build-docs.yml similarity index 100% rename from .github/workflows/deploy/docs.yml rename to .github/workflows/build-docs.yml diff --git a/.github/workflows/deploy/fastgpt.yml b/.github/workflows/build-fastgpt.yml similarity index 100% rename from .github/workflows/deploy/fastgpt.yml rename to .github/workflows/build-fastgpt.yml diff --git a/.github/workflows/deploy/marketplace-image.yml b/.github/workflows/build-marketplace.yml similarity index 100% rename from .github/workflows/deploy/marketplace-image.yml rename to .github/workflows/build-marketplace.yml diff --git a/.github/workflows/deploy/mcp-server.yml b/.github/workflows/build-mcp-server.yml similarity index 100% rename from .github/workflows/deploy/mcp-server.yml rename to .github/workflows/build-mcp-server.yml diff --git a/.github/workflows/deploy/sandbox.yml b/.github/workflows/build-sandbox.yml similarity index 100% rename from .github/workflows/deploy/sandbox.yml rename to .github/workflows/build-sandbox.yml diff --git a/.github/workflows/preview/docs-build.yml b/.github/workflows/preview-docs-build.yml similarity index 86% rename from .github/workflows/preview/docs-build.yml rename to .github/workflows/preview-docs-build.yml index 86ca3139b9..9280b0199f 100644 --- a/.github/workflows/preview/docs-build.yml +++ b/.github/workflows/preview-docs-build.yml @@ -58,15 +58,5 @@ jobs: path: /tmp/fastgpt-docs-${{ steps.datetime.outputs.datetime }}.tar retention-days: 1 - - name: Comment build status - uses: FinleyGe/github-tools@0.0.1 - if: success() - with: - token: ${{ secrets.GITHUB_TOKEN }} - tool: issue-comment - title: 'Docs Preview Build:' - body: | - Build completed. Waiting for deployment... - outputs: datetime: ${{ steps.datetime.outputs.datetime }} diff --git a/.github/workflows/preview/docs-push.yml b/.github/workflows/preview-docs-push.yml similarity index 86% rename from .github/workflows/preview/docs-push.yml rename to .github/workflows/preview-docs-push.yml index 5b1c4c1351..64c43a8d41 100644 --- a/.github/workflows/preview/docs-push.yml +++ b/.github/workflows/preview-docs-push.yml @@ -4,6 +4,8 @@ on: workflow_run: workflows: ["Build Docs Preview (Unprivileged)"] types: [completed] + branches: + - '**' # 监听所有分支 permissions: contents: read @@ -11,6 +13,7 @@ permissions: attestations: write id-token: write pull-requests: write + issues: write # Required for issue-comment (PR comments use Issues API) jobs: push-and-deploy: @@ -23,19 +26,24 @@ jobs: uses: actions/github-script@v7 with: script: | + // 获取触发工作流的 PR 信息 const { data: pullRequests } = await github.rest.pulls.list({ owner: context.repo.owner, repo: context.repo.repo, state: 'open', - head: `${context.repo.owner}:${context.payload.workflow_run.head_branch}` }); - if (pullRequests.length === 0) { - core.setFailed('No open PR found for this branch'); + // 查找匹配的 PR(支持 fork 仓库) + const pr = pullRequests.find(pr => + pr.head.ref === context.payload.workflow_run.head_branch && + pr.head.sha === context.payload.workflow_run.head_sha + ); + + if (!pr) { + core.setFailed('No open PR found for this branch and commit'); return; } - const pr = pullRequests[0]; core.setOutput('number', pr.number); - name: Get workflow artifacts @@ -107,6 +115,7 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} tool: issue-comment + issue-number: ${{ steps.pr.outputs.number }} title: 'Docs Preview:' body: | --- @@ -120,6 +129,7 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} tool: issue-comment + issue-number: ${{ steps.pr.outputs.number }} title: 'Docs Preview Deployment Failed' body: | Failed to deploy docs preview. Please check workflow logs. diff --git a/.github/workflows/preview/fastgpt-build.yml b/.github/workflows/preview-fastgpt-build.yml similarity index 91% rename from .github/workflows/preview/fastgpt-build.yml rename to .github/workflows/preview-fastgpt-build.yml index b85d76c6b0..5aa23a7218 100644 --- a/.github/workflows/preview/fastgpt-build.yml +++ b/.github/workflows/preview-fastgpt-build.yml @@ -88,13 +88,3 @@ jobs: name: ${{ steps.config.outputs.IMAGE_NAME }}-${{ github.sha }} path: /tmp/${{ steps.config.outputs.IMAGE_NAME }}-${{ github.sha }}.tar retention-days: 1 - - - name: Comment build status - uses: FinleyGe/github-tools@0.0.1 - if: success() - with: - token: ${{ secrets.GITHUB_TOKEN }} - tool: issue-comment - title: 'Preview ${{ matrix.image }} Image Built:' - body: | - Build completed. Waiting for push workflow... diff --git a/.github/workflows/preview/fastgpt-push.yml b/.github/workflows/preview-fastgpt-push.yml similarity index 86% rename from .github/workflows/preview/fastgpt-push.yml rename to .github/workflows/preview-fastgpt-push.yml index b2831c03af..17097031d6 100644 --- a/.github/workflows/preview/fastgpt-push.yml +++ b/.github/workflows/preview-fastgpt-push.yml @@ -4,6 +4,8 @@ on: workflow_run: workflows: ["FastGPT Build (Unprivileged)"] types: [completed] + branches: + - '**' # 监听所有分支 jobs: push-preview-images: @@ -16,6 +18,7 @@ jobs: attestations: write id-token: write pull-requests: write + issues: write # Required for issue-comment (PR comments use Issues API) runs-on: ubuntu-24.04 strategy: @@ -29,19 +32,24 @@ jobs: uses: actions/github-script@v7 with: script: | + // 获取触发工作流的 PR 信息 const { data: pullRequests } = await github.rest.pulls.list({ owner: context.repo.owner, repo: context.repo.repo, state: 'open', - head: `${context.repo.owner}:${context.payload.workflow_run.head_branch}` }); - if (pullRequests.length === 0) { - core.setFailed('No open PR found for this branch'); + // 查找匹配的 PR(支持 fork 仓库) + const pr = pullRequests.find(pr => + pr.head.ref === context.payload.workflow_run.head_branch && + pr.head.sha === context.payload.workflow_run.head_sha + ); + + if (!pr) { + core.setFailed('No open PR found for this branch and commit'); return; } - const pr = pullRequests[0]; core.setOutput('number', pr.number); core.setOutput('sha', context.payload.workflow_run.head_sha); @@ -106,6 +114,7 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} tool: issue-comment + issue-number: ${{ steps.pr.outputs.number }} title: 'Preview ${{ matrix.image }} Image:' body: | ``` @@ -118,6 +127,7 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} tool: issue-comment + issue-number: ${{ steps.pr.outputs.number }} title: 'Preview ${{ matrix.image }} Image Push Failed' body: | Failed to push preview image. Please check workflow logs. diff --git a/.github/workflows/test/fastgpt-test.yaml b/.github/workflows/test-fastgpt.yaml similarity index 100% rename from .github/workflows/test/fastgpt-test.yaml rename to .github/workflows/test-fastgpt.yaml diff --git a/.github/workflows/test/sandbox-test.yaml b/.github/workflows/test-sandbox.yaml similarity index 100% rename from .github/workflows/test/sandbox-test.yaml rename to .github/workflows/test-sandbox.yaml