Skip to content

Commit 7b572c4

Browse files
committed
Add auto PR workflow and update manifest author
1 parent c152b63 commit 7b572c4

2 files changed

Lines changed: 79 additions & 1 deletion

File tree

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Auto Create PR on Main Push
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
7+
env:
8+
TARGET_REPO: drpr/dify-byteplus-plugins
9+
UPSTREAM_REPO: langgenius/dify-plugins
10+
11+
jobs:
12+
create_pr:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v3
17+
18+
- name: Download CLI tool
19+
run: |
20+
mkdir -p $RUNNER_TEMP/bin
21+
cd $RUNNER_TEMP/bin
22+
wget https://github.com/langgenius/dify-plugin-daemon/releases/download/0.0.6/dify-plugin-linux-amd64
23+
chmod +x dify-plugin-linux-amd64
24+
25+
- name: Get basic info from manifest
26+
id: get_basic_info
27+
run: |
28+
PLUGIN_NAME=$(grep "^name:" manifest.yaml | cut -d' ' -f2)
29+
echo "plugin_name=$PLUGIN_NAME" >> $GITHUB_OUTPUT
30+
VERSION=$(grep "^version:" manifest.yaml | cut -d' ' -f2)
31+
echo "version=$VERSION" >> $GITHUB_OUTPUT
32+
AUTHOR=$(grep "^author:" manifest.yaml | cut -d' ' -f2)
33+
echo "author=$AUTHOR" >> $GITHUB_OUTPUT
34+
35+
- name: Package Plugin
36+
id: package
37+
run: |
38+
cd $GITHUB_WORKSPACE
39+
PACKAGE_NAME="${{ steps.get_basic_info.outputs.plugin_name }}-${{ steps.get_basic_info.outputs.version }}.difypkg"
40+
$RUNNER_TEMP/bin/dify-plugin-linux-amd64 plugin package . -o "$PACKAGE_NAME"
41+
echo "package_name=$PACKAGE_NAME" >> $GITHUB_OUTPUT
42+
43+
- name: Checkout target repo
44+
uses: actions/checkout@v3
45+
with:
46+
repository: ${{ env.TARGET_REPO }}
47+
path: dify-plugins
48+
token: ${{ secrets.PLUGIN_ACTION }}
49+
fetch-depth: 1
50+
persist-credentials: true
51+
52+
- name: Prepare and push branch
53+
run: |
54+
PACKAGE_NAME="${{ steps.get_basic_info.outputs.plugin_name }}-${{ steps.get_basic_info.outputs.version }}.difypkg"
55+
mkdir -p dify-plugins/${{ steps.get_basic_info.outputs.author }}/${{ steps.get_basic_info.outputs.plugin_name }}
56+
mv "$PACKAGE_NAME" dify-plugins/${{ steps.get_basic_info.outputs.author }}/${{ steps.get_basic_info.outputs.plugin_name }}/
57+
cd dify-plugins
58+
git config user.name "GitHub Actions"
59+
git config user.email "actions@github.com"
60+
git fetch origin main
61+
git checkout main
62+
git pull origin main
63+
BRANCH_NAME="bump-${{ steps.get_basic_info.outputs.plugin_name }}-plugin-${{ steps.get_basic_info.outputs.version }}"
64+
git checkout -b "$BRANCH_NAME"
65+
git add .
66+
git commit -m "bump ${{ steps.get_basic_info.outputs.plugin_name }} plugin to version ${{ steps.get_basic_info.outputs.version }}"
67+
git push -u origin "$BRANCH_NAME" --force
68+
69+
- name: Create PR via GitHub API
70+
env:
71+
GH_TOKEN: ${{ secrets.PLUGIN_ACTION }}
72+
run: |
73+
gh pr create \
74+
--repo "${{ env.UPSTREAM_REPO }}" \
75+
--head "${{ steps.get_basic_info.outputs.author }}:bump-${{ steps.get_basic_info.outputs.plugin_name }}-plugin-${{ steps.get_basic_info.outputs.version }}" \
76+
--base main \
77+
--title "bump ${{ steps.get_basic_info.outputs.plugin_name }} plugin to version ${{ steps.get_basic_info.outputs.version }}" \
78+
--body "bump ${{ steps.get_basic_info.outputs.plugin_name }} plugin package to version ${{ steps.get_basic_info.outputs.version }}\n\nChanges:\n- Updated plugin package file" || echo "PR already exists or creation skipped."

manifest.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
author: byteplus
1+
author: drpr
22
created_at: '2026-02-13T00:00:00Z'
33
description:
44
en_US: BytePlus ModelArk models.

0 commit comments

Comments
 (0)