mirror of
https://github.com/labring/FastGPT.git
synced 2026-03-23 01:07:13 +08:00
V4.14.9 dev (#6568)
* action * action * rename action * action * action
This commit is contained in:
@@ -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 }}
|
||||
@@ -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.
|
||||
@@ -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...
|
||||
@@ -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.
|
||||
Reference in New Issue
Block a user