Skip to content

Commit 51dee93

Browse files
committed
ci(plugin-publish): 更新插件发布工作流以使用GitHub用户信息
- 将actions/checkout从v3升级到v4 - 使用GitHub用户名替代作者信息进行仓库操作 - 改进PR分支命名格式为bump-{plugin}-plugin-{version}
1 parent 444efd3 commit 51dee93

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

.github/workflows/plugin-publish.yml

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
# .github/workflows/auto-pr.yml
2-
name: Auto Create PR on Main Push
1+
# .github/workflows/plugin-publish.yml
2+
name: Plugin Auto-PR
33

44
on:
55
push:
66
branches: [ main ] # Trigger on push to main
77

88
jobs:
9-
create_pr: # Renamed job for clarity
9+
auto_pr:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- name: Checkout code
13-
uses: actions/checkout@v3
13+
uses: actions/checkout@v4
1414

1515
- name: Print working directory # Kept for debugging
1616
run: |
@@ -32,7 +32,7 @@ jobs:
3232
pwd
3333
ls -la dify-plugin-linux-amd64
3434
35-
- name: Get basic info from manifest # Changed step name and content
35+
- name: Get basic info from manifest
3636
id: get_basic_info
3737
run: |
3838
PLUGIN_NAME=$(grep "^name:" manifest.yaml | cut -d' ' -f2)
@@ -43,11 +43,16 @@ jobs:
4343
echo "Plugin version: $VERSION"
4444
echo "version=$VERSION" >> $GITHUB_OUTPUT
4545
46-
# If the author's name is not your github username, you can change the author here
46+
# Get author from manifest.yaml (for plugin metadata)
4747
AUTHOR=$(grep "^author:" manifest.yaml | cut -d' ' -f2)
4848
echo "Plugin author: $AUTHOR"
4949
echo "author=$AUTHOR" >> $GITHUB_OUTPUT
5050
51+
# GitHub username for repository operations (auto-detect from current repo)
52+
GITHUB_USER="${{ github.repository_owner }}"
53+
echo "GitHub user: $GITHUB_USER"
54+
echo "github_user=$GITHUB_USER" >> $GITHUB_OUTPUT
55+
5156
- name: Package Plugin
5257
id: package
5358
run: |
@@ -70,14 +75,14 @@ jobs:
7075
tree || ls -R
7176
7277
- name: Checkout target repo
73-
uses: actions/checkout@v3
78+
uses: actions/checkout@v4
7479
with:
75-
# Use author variable for repository
76-
repository: ${{steps.get_basic_info.outputs.author}}/dify-plugins
80+
# Use GitHub username for repository
81+
repository: ${{steps.get_basic_info.outputs.github_user}}/dify-plugins
7782
path: dify-plugins
7883
token: ${{ secrets.PLUGIN_ACTION }}
79-
fetch-depth: 1 # Fetch only the last commit to speed up checkout
80-
persist-credentials: true # Persist credentials for subsequent git operations
84+
fetch-depth: 1
85+
persist-credentials: true
8186

8287
- name: Prepare and create PR
8388
run: |
@@ -89,8 +94,8 @@ jobs:
8994
ls -la
9095
9196
# Move the packaged file to the target directory using variables
92-
mkdir -p dify-plugins/${{ steps.get_basic_info.outputs.author }}/${{ steps.get_basic_info.outputs.plugin_name }}
93-
mv "$PACKAGE_NAME" dify-plugins/${{ steps.get_basic_info.outputs.author }}/${{ steps.get_basic_info.outputs.plugin_name }}/
97+
mkdir -p dify-plugins/${{ steps.get_basic_info.outputs.github_user }}/${{ steps.get_basic_info.outputs.plugin_name }}
98+
mv "$PACKAGE_NAME" dify-plugins/${{ steps.get_basic_info.outputs.github_user }}/${{ steps.get_basic_info.outputs.plugin_name }}/
9499
95100
# Enter the target repository directory
96101
cd dify-plugins
@@ -128,7 +133,7 @@ jobs:
128133
run: |
129134
gh pr create \
130135
--repo langgenius/dify-plugins \
131-
--head "${{ steps.get_basic_info.outputs.author }}:${{ steps.get_basic_info.outputs.plugin_name }}-${{ steps.get_basic_info.outputs.version }}" \
136+
--head "${{ steps.get_basic_info.outputs.github_user }}:bump-${{ steps.get_basic_info.outputs.plugin_name }}-plugin-${{ steps.get_basic_info.outputs.version }}" \
132137
--base main \
133138
--title "bump ${{ steps.get_basic_info.outputs.plugin_name }} plugin to version ${{ steps.get_basic_info.outputs.version }}" \
134139
--body "bump ${{ steps.get_basic_info.outputs.plugin_name }} plugin package to version ${{ steps.get_basic_info.outputs.version }}

0 commit comments

Comments
 (0)