Skip to content

Commit dc76746

Browse files
committed
ci(workflow): 添加权限和token认证以支持插件发布
为插件发布工作流添加必要的仓库写入权限和GITHUB_TOKEN认证,确保自动化流程能够正常提交包文件到源码仓库
1 parent ce414e0 commit dc76746

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

.github/workflows/plugin-publish.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ on:
88
jobs:
99
auto_pr:
1010
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
pull-requests: write
14+
actions: read
1115
steps:
1216
- name: Checkout code
1317
uses: actions/checkout@v4
@@ -80,6 +84,8 @@ jobs:
8084
tree || ls -R
8185
8286
- name: Commit package to source repo
87+
env:
88+
GITHUB_TOKEN: ${{ secrets.PLUGIN_ACTION }}
8389
run: |
8490
# Create releases directory if it doesn't exist
8591
mkdir -p releases
@@ -88,10 +94,13 @@ jobs:
8894
PACKAGE_NAME="${{ steps.get_basic_info.outputs.plugin_name }}-${{ steps.get_basic_info.outputs.version }}.difypkg"
8995
cp "$PACKAGE_NAME" releases/
9096
91-
# Configure git
97+
# Configure git with token authentication
9298
git config user.name "GitHub Actions"
9399
git config user.email "[email protected]"
94100
101+
# Set up remote URL with token for authentication
102+
git remote set-url origin https://x-access-token:${{ secrets.PLUGIN_ACTION }}@github.com/${{ github.repository }}.git
103+
95104
# Add and commit the package file
96105
git add releases/"$PACKAGE_NAME"
97106

0 commit comments

Comments
 (0)