Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
赵月辉
/
fastgpt-migrated
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Unverified
Commit
a8d09818
authored
Mar 16, 2026
by
Archer
Committed by
GitHub
Mar 16, 2026
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update action (#6569)
* action * action * action
parent
d6db937a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
110 additions
and
99 deletions
+110
-99
.github/workflows/preview-docs-build.yml
+23
-1
.github/workflows/preview-docs-push.yml
+32
-53
.github/workflows/preview-fastgpt-build.yml
+28
-1
.github/workflows/preview-fastgpt-push.yml
+27
-44
No files found.
.github/workflows/preview-docs-build.yml
View file @
a8d09818
name
:
Build Docs Preview (Unprivileged)
name
:
Preview docs build
on
:
pull_request
:
...
...
@@ -34,6 +34,12 @@ jobs:
id
:
datetime
run
:
echo "datetime=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT
-
name
:
Save PR metadata
run
:
|
mkdir -p /tmp/pr-metadata
echo "${{ github.event.pull_request.number }}" > /tmp/pr-metadata/pr-number.txt
echo "${{ github.event.pull_request.head.sha }}" > /tmp/pr-metadata/pr-sha.txt
-
name
:
Set up Docker Buildx
uses
:
docker/setup-buildx-action@v3
...
...
@@ -58,5 +64,21 @@ jobs:
path
:
/tmp/fastgpt-docs-${{ steps.datetime.outputs.datetime }}.tar
retention-days
:
1
-
name
:
Upload PR metadata
uses
:
actions/upload-artifact@v4
with
:
name
:
pr-metadata-docs-${{ steps.datetime.outputs.datetime }}
path
:
/tmp/pr-metadata/
retention-days
:
1
call-push-workflow
:
needs
:
build-docs-image
uses
:
./.github/workflows/preview-docs-push.yml
secrets
:
inherit
with
:
pr_number
:
${{ github.event.pull_request.number }}
datetime
:
${{ needs.build-docs-image.outputs.datetime }}
run_id
:
${{ github.run_id }}
outputs
:
datetime
:
${{ steps.datetime.outputs.datetime }}
.github/workflows/preview-docs-push.yml
View file @
a8d09818
name
:
Deploy Docs Preview (Privileged)
name
:
Preview docs push
on
:
workflow_run
:
workflows
:
[
"
Build
Docs
Preview
(Unprivileged)"
]
types
:
[
completed
]
branches
:
-
'
**'
# 监听所有分支
workflow_call
:
inputs
:
pr_number
:
required
:
true
type
:
string
datetime
:
required
:
true
type
:
string
run_id
:
required
:
true
type
:
string
permissions
:
contents
:
read
...
...
@@ -13,67 +19,40 @@ permissions:
attestations
:
write
id-token
:
write
pull-requests
:
write
issues
:
write
# Required for issue-comment (PR comments use Issues API)
issues
:
write
# Required for issue-comment (PR comments use Issues API)
jobs
:
push-and-deploy
:
if
:
${{ github.event.workflow_run.conclusion == 'success' }}
runs-on
:
ubuntu-24.04
steps
:
-
name
:
Get PR information
id
:
pr
uses
:
actions/github-script@v7
-
name
:
Download PR metadata
uses
:
actions/download-artifact@v4
with
:
script
:
|
// 获取触发工作流的 PR 信息
const { data: pullRequests } = await github.rest.pulls.list({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
});
// 查找匹配的 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;
}
core.setOutput('number', pr.number);
-
name
:
Get workflow artifacts
uses
:
actions/github-script@v7
name
:
pr-metadata-docs-${{ inputs.datetime }}
path
:
/tmp/pr-metadata/
run-id
:
${{ inputs.run_id }}
github-token
:
${{ secrets.GITHUB_TOKEN }}
-
name
:
Read PR information
id
:
pr
run
:
|
PR_NUMBER="${{ inputs.pr_number }}"
echo "number=$PR_NUMBER" >> $GITHUB_OUTPUT
echo "Found PR #$PR_NUMBER"
-
name
:
Get artifact name
id
:
artifacts
with
:
script
:
|
const artifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.payload.workflow_run.id,
});
const artifact = artifacts.data.artifacts[0];
if (!artifact) {
core.setFailed('No artifact found');
return;
}
// Extract datetime from artifact name
const datetime = artifact.name.replace('fastgpt-docs-', '');
core.setOutput('datetime', datetime);
core.setOutput('artifact_name', artifact.name);
run
:
|
echo "datetime=${{ inputs.datetime }}" >> $GITHUB_OUTPUT
echo "artifact_name=fastgpt-docs-${{ inputs.datetime }}" >> $GITHUB_OUTPUT
-
name
:
Download image artifact
uses
:
actions/download-artifact@v4
with
:
name
:
${{ steps.artifacts.outputs.artifact_name }}
path
:
/tmp/
run-id
:
${{
github.event.workflow_run.
id }}
run-id
:
${{
inputs.run_
id }}
github-token
:
${{ secrets.GITHUB_TOKEN }}
-
name
:
Load Docker image
...
...
.github/workflows/preview-fastgpt-build.yml
View file @
a8d09818
name
:
FastGPT Build (Unprivileged)
name
:
Preview fastgpt build
on
:
pull_request
:
...
...
@@ -33,6 +33,12 @@ jobs:
ref
:
${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.sha }}
fetch-depth
:
0
-
name
:
Save PR metadata
run
:
|
mkdir -p /tmp/pr-metadata
echo "${{ github.event.pull_request.number }}" > /tmp/pr-metadata/pr-number.txt
echo "${{ github.event.pull_request.head.sha }}" > /tmp/pr-metadata/pr-sha.txt
-
name
:
Set up Docker Buildx
uses
:
docker/setup-buildx-action@v3
with
:
...
...
@@ -88,3 +94,24 @@ jobs:
name
:
${{ steps.config.outputs.IMAGE_NAME }}-${{ github.sha }}
path
:
/tmp/${{ steps.config.outputs.IMAGE_NAME }}-${{ github.sha }}.tar
retention-days
:
1
-
name
:
Upload PR metadata
uses
:
actions/upload-artifact@v4
with
:
name
:
pr-metadata-${{ matrix.image }}-${{ github.sha }}
path
:
/tmp/pr-metadata/
retention-days
:
1
call-push-workflow
:
needs
:
build-preview-images
strategy
:
matrix
:
image
:
[
fastgpt
,
sandbox
,
mcp_server
]
fail-fast
:
false
uses
:
./.github/workflows/preview-fastgpt-push.yml
secrets
:
inherit
with
:
pr_number
:
${{ github.event.pull_request.number }}
pr_sha
:
${{ github.sha }}
run_id
:
${{ github.run_id }}
image
:
${{ matrix.image }}
.github/workflows/preview-fastgpt-push.yml
View file @
a8d09818
name
:
FastGPT Push (Privileged)
name
:
Preview fastgpt push
on
:
workflow_run
:
workflows
:
[
"
FastGPT
Build
(Unprivileged)"
]
types
:
[
completed
]
branches
:
-
'
**'
# 监听所有分支
workflow_call
:
inputs
:
pr_number
:
required
:
true
type
:
string
pr_sha
:
required
:
true
type
:
string
run_id
:
required
:
true
type
:
string
image
:
required
:
true
type
:
string
jobs
:
push-preview-images
:
# 只在构建成功时运行
if
:
${{ github.event.workflow_run.conclusion == 'success' }}
permissions
:
contents
:
read
packages
:
write
attestations
:
write
id-token
:
write
pull-requests
:
write
issues
:
write
# Required for issue-comment (PR comments use Issues API)
issues
:
write
# Required for issue-comment (PR comments use Issues API)
runs-on
:
ubuntu-24.04
strategy
:
matrix
:
image
:
[
fastgpt
,
sandbox
,
mcp_server
]
fail-fast
:
false
steps
:
-
name
:
Get
PR information
-
name
:
Read
PR information
id
:
pr
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',
});
// 查找匹配的 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;
}
core.setOutput('number', pr.number);
core.setOutput('sha', context.payload.workflow_run.head_sha);
run
:
|
echo "number=${{ inputs.pr_number }}" >> $GITHUB_OUTPUT
echo "sha=${{ inputs.pr_sha }}" >> $GITHUB_OUTPUT
echo "Found PR #${{ inputs.pr_number }} (SHA: ${{ inputs.pr_sha }})"
-
name
:
Set image config
id
:
config
run
:
|
SHA="${{ steps.pr.outputs.sha }}"
if [[ "${{
matrix
.image }}" == "fastgpt" ]]; then
if [[ "${{
inputs
.image }}" == "fastgpt" ]]; then
echo "IMAGE_NAME=fastgpt" >> $GITHUB_OUTPUT
echo "DESCRIPTION=fastgpt-pr image" >> $GITHUB_OUTPUT
echo "DOCKER_REPO_TAGGED=${{ secrets.FASTGPT_ALI_IMAGE_PREFIX }}/fastgpt-pr:fastgpt_${SHA}" >> $GITHUB_OUTPUT
elif [[ "${{
matrix
.image }}" == "sandbox" ]]; then
elif [[ "${{
inputs
.image }}" == "sandbox" ]]; then
echo "IMAGE_NAME=fastgpt-sandbox" >> $GITHUB_OUTPUT
echo "DESCRIPTION=fastgpt-sandbox-pr image" >> $GITHUB_OUTPUT
echo "DOCKER_REPO_TAGGED=${{ secrets.FASTGPT_ALI_IMAGE_PREFIX }}/fastgpt-pr:fastgpt_sandbox_${SHA}" >> $GITHUB_OUTPUT
elif [[ "${{
matrix
.image }}" == "mcp_server" ]]; then
elif [[ "${{
inputs
.image }}" == "mcp_server" ]]; then
echo "IMAGE_NAME=fastgpt-mcp-server" >> $GITHUB_OUTPUT
echo "DESCRIPTION=fastgpt-mcp_server-pr image" >> $GITHUB_OUTPUT
echo "DOCKER_REPO_TAGGED=${{ secrets.FASTGPT_ALI_IMAGE_PREFIX }}/fastgpt-pr:fastgpt_mcp_server_${SHA}" >> $GITHUB_OUTPUT
...
...
@@ -77,7 +60,7 @@ jobs:
with
:
name
:
${{ steps.config.outputs.IMAGE_NAME }}-${{ steps.pr.outputs.sha }}
path
:
/tmp/
run-id
:
${{
github.event.workflow_run.
id }}
run-id
:
${{
inputs.run_
id }}
github-token
:
${{ secrets.GITHUB_TOKEN }}
-
name
:
Load Docker image
...
...
@@ -115,7 +98,7 @@ jobs:
token
:
${{ secrets.GITHUB_TOKEN }}
tool
:
issue-comment
issue-number
:
${{ steps.pr.outputs.number }}
title
:
'
Preview
${{
matrix
.image
}}
Image:'
title
:
'
Preview
${{
inputs
.image
}}
Image:'
body
:
|
```
${{ steps.config.outputs.DOCKER_REPO_TAGGED }}
...
...
@@ -128,6 +111,6 @@ jobs:
token
:
${{ secrets.GITHUB_TOKEN }}
tool
:
issue-comment
issue-number
:
${{ steps.pr.outputs.number }}
title
:
'
Preview
${{
matrix
.image
}}
Image
Push
Failed'
title
:
'
Preview
${{
inputs
.image
}}
Image
Push
Failed'
body
:
|
Failed to push preview image. Please check workflow logs.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment