V4.14.9 dev (#6568)

* action

* action

* rename action

* action

* action
This commit is contained in:
Archer
2026-03-16 19:49:53 +08:00
committed by GitHub
parent 7101ba5fee
commit d6db937ac5
11 changed files with 28 additions and 28 deletions

View File

@@ -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 }}

View File

@@ -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.

View File

@@ -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...

View File

@@ -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.