Skip to content

Commit a21d42f

Browse files
committed
Merge branch 'taichuy_dev'
2 parents 30e4ff4 + 444efd3 commit a21d42f

File tree

2 files changed

+51
-16
lines changed

2 files changed

+51
-16
lines changed

.github/workflows/plugin-publish.yml

Lines changed: 47 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,38 @@
1-
name: Plugin Publish Workflow
1+
# .github/workflows/auto-pr.yml
2+
name: Auto Create PR on Main Push
23

34
on:
4-
release:
5-
types: [published]
5+
push:
6+
branches: [ main ] # Trigger on push to main
67

78
jobs:
8-
publish:
9+
create_pr: # Renamed job for clarity
910
runs-on: ubuntu-latest
1011
steps:
1112
- name: Checkout code
1213
uses: actions/checkout@v3
1314

15+
- name: Print working directory # Kept for debugging
16+
run: |
17+
pwd
18+
ls -la
19+
1420
- name: Download CLI tool
1521
run: |
22+
# Create bin directory in runner temp
1623
mkdir -p $RUNNER_TEMP/bin
1724
cd $RUNNER_TEMP/bin
1825
26+
# Download CLI tool
1927
wget https://github.com/langgenius/dify-plugin-daemon/releases/download/0.0.6/dify-plugin-linux-amd64
2028
chmod +x dify-plugin-linux-amd64
2129
30+
# Show download location and file
2231
echo "CLI tool location:"
2332
pwd
2433
ls -la dify-plugin-linux-amd64
2534
26-
- name: Get basic info from manifest
35+
- name: Get basic info from manifest # Changed step name and content
2736
id: get_basic_info
2837
run: |
2938
PLUGIN_NAME=$(grep "^name:" manifest.yaml | cut -d' ' -f2)
@@ -42,61 +51,80 @@ jobs:
4251
- name: Package Plugin
4352
id: package
4453
run: |
54+
# Use the downloaded CLI tool to package
4555
cd $GITHUB_WORKSPACE
56+
# Use variables for package name
4657
PACKAGE_NAME="${{ steps.get_basic_info.outputs.plugin_name }}-${{ steps.get_basic_info.outputs.version }}.difypkg"
58+
# Use CLI from runner temp
4759
$RUNNER_TEMP/bin/dify-plugin-linux-amd64 plugin package . -o "$PACKAGE_NAME"
4860
61+
# Show packaging result
4962
echo "Package result:"
5063
ls -la "$PACKAGE_NAME"
5164
echo "package_name=$PACKAGE_NAME" >> $GITHUB_OUTPUT
5265
53-
echo "\nFull file path:"
66+
# Show full file path and directory structure (kept for debugging)
67+
echo "\\nFull file path:"
5468
pwd
55-
echo "\nDirectory structure:"
69+
echo "\\nDirectory structure:"
5670
tree || ls -R
5771
5872
- name: Checkout target repo
5973
uses: actions/checkout@v3
6074
with:
75+
# Use author variable for repository
6176
repository: ${{steps.get_basic_info.outputs.author}}/dify-plugins
6277
path: dify-plugins
6378
token: ${{ secrets.PLUGIN_ACTION }}
64-
fetch-depth: 1
65-
persist-credentials: true
79+
fetch-depth: 1 # Fetch only the last commit to speed up checkout
80+
persist-credentials: true # Persist credentials for subsequent git operations
6681

6782
- name: Prepare and create PR
6883
run: |
84+
# Debug info (kept)
85+
echo "Debug: Current directory $(pwd)"
86+
# Use variable for package name
6987
PACKAGE_NAME="${{ steps.get_basic_info.outputs.plugin_name }}-${{ steps.get_basic_info.outputs.version }}.difypkg"
88+
echo "Debug: Package name: $PACKAGE_NAME"
89+
ls -la
90+
91+
# Move the packaged file to the target directory using variables
7092
mkdir -p dify-plugins/${{ steps.get_basic_info.outputs.author }}/${{ steps.get_basic_info.outputs.plugin_name }}
7193
mv "$PACKAGE_NAME" dify-plugins/${{ steps.get_basic_info.outputs.author }}/${{ steps.get_basic_info.outputs.plugin_name }}/
7294
95+
# Enter the target repository directory
7396
cd dify-plugins
7497
98+
# Configure git
7599
git config user.name "GitHub Actions"
76100
git config user.email "[email protected]"
77101
102+
# Ensure we are on the latest main branch
78103
git fetch origin main
79104
git checkout main
80105
git pull origin main
81106
107+
# Create and switch to a new branch using variables and new naming convention
82108
BRANCH_NAME="bump-${{ steps.get_basic_info.outputs.plugin_name }}-plugin-${{ steps.get_basic_info.outputs.version }}"
83109
git checkout -b "$BRANCH_NAME"
84110
111+
# Add and commit changes (using git add .)
85112
git add .
113+
git status # for debugging
114+
# Use variables in commit message
86115
git commit -m "bump ${{ steps.get_basic_info.outputs.plugin_name }} plugin to version ${{ steps.get_basic_info.outputs.version }}"
87116
117+
# Push to remote (use force just in case the branch existed before from a failed run)
88118
git push -u origin "$BRANCH_NAME" --force
89119
120+
# Confirm branch has been pushed and wait for sync (GitHub API might need a moment)
90121
git branch -a
91122
echo "Waiting for branch to sync..."
92123
sleep 10 # Wait 10 seconds for branch sync
93124
94125
- name: Create PR via GitHub API
95126
env:
96-
# How to config the token:
97-
# 1. Profile -> Settings -> Developer settings -> Personal access tokens -> Generate new token (with repo scope) -> Copy the token
98-
# 2. Go to the target repository -> Settings -> Secrets and variables -> Actions -> New repository secret -> Add the token as PLUGIN_ACTION
99-
GH_TOKEN: ${{ secrets.PLUGIN_ACTION }}
127+
GH_TOKEN: ${{ secrets.PLUGIN_ACTION }} # Use the provided token for authentication
100128
run: |
101129
gh pr create \
102130
--repo langgenius/dify-plugins \
@@ -107,3 +135,9 @@ jobs:
107135
108136
Changes:
109137
- Updated plugin package file" || echo "PR already exists or creation skipped." # Handle cases where PR already exists
138+
139+
- name: Print environment info # Kept for debugging
140+
run: |
141+
echo "GITHUB_WORKSPACE: $GITHUB_WORKSPACE"
142+
echo "Current directory contents:"
143+
ls -R

tools/dify_chatflow_sse.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,15 @@ parameters:
2020
- name: url
2121
type: string
2222
required: true
23+
default: "http://api:5001/v1/chat-messages"
2324
label:
2425
en_US: "Dify Chatflow SSE URL"
2526
zh_Hans: "Dify Chatflow SSE URL"
2627
pt_BR: "URL do Dify Chatflow SSE"
2728
human_description:
28-
en_US: "Enter the complete Dify Chatflow SSE URL. Must start with http:// or https://. Example: https://api.dify.ai/v1/chat-messages. Make sure the endpoint supports Server-Sent Events for Dify Chatflow."
29-
zh_Hans: "输入完整的Dify Chatflow SSE URL。必须以http://或https://开头。示例:https://api.dify.ai/v1/chat-messages。确保端点支持Dify Chatflow的服务器发送事件。"
30-
pt_BR: "Digite a URL completa do Dify Chatflow SSE. Deve começar com http:// ou https://. Exemplo: https://api.dify.ai/v1/chat-messages. Certifique-se de que o endpoint suporte Server-Sent Events para Dify Chatflow."
29+
en_US: "Enter the complete Dify Chatflow SSE URL. Must start with http:// or https://. Example: http://api:5001/v1/chat-messages. Make sure the endpoint supports Server-Sent Events for Dify Chatflow."
30+
zh_Hans: "输入完整的Dify Chatflow SSE URL。必须以http://或https://开头。示例:http://api:5001/v1/chat-messages。确保端点支持Dify Chatflow的服务器发送事件。"
31+
pt_BR: "Digite a URL completa do Dify Chatflow SSE. Deve começar com http:// ou https://. Exemplo: http://api:5001/v1/chat-messages. Certifique-se de que o endpoint suporte Server-Sent Events para Dify Chatflow."
3132
llm_description: "The complete URL of the Dify Chatflow SSE endpoint, must start with http:// or https://"
3233
form: llm
3334

0 commit comments

Comments
 (0)