Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dify
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ai-tech
dify
Commits
0c97160c
Commit
0c97160c
authored
Jan 22, 2024
by
chenhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
6bfab2aa
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
9 deletions
+13
-9
sync-howto-docs.yml
.github/workflows/sync-howto-docs.yml
+13
-9
No files found.
.github/workflows/sync-howto-docs.yml
View file @
0c97160c
...
...
@@ -3,7 +3,8 @@ name: Sync How-To Markdown Files to Documentation Repo
on
:
push
:
branches
:
-
chore/test-howto-sync
-
'
main'
-
'
test-howto-sync'
paths
:
-
'
**/howto-*.md'
...
...
@@ -15,10 +16,12 @@ jobs:
uses
:
actions/checkout@v4
with
:
fetch-depth
:
0
-
name
:
Sparse
Checkout and Sync F
iles
-
name
:
Sparse
checkout and sync f
iles
env
:
TARGET_REPO
:
'
https://github.com/langgenius/dify-docs.git'
TARGET_BRANCH
:
'
test-howto-sync'
TARGET_SECTION_EN
:
'
en/tutorials/'
TARGET_SECTION_ZH
:
'
zh_CN/tutorials/'
ACCESS_TOKEN
:
${{ secrets.DIFY_DOCS_ACCESS_TOKEN }}
run
:
|
CHANGED_HOWTOS=$(git diff --no-renames --name-only --diff-filter=AMDR ${{ github.event.before }}..${{ github.event.after }} | grep -e 'howto-.*\.md$' || true)
...
...
@@ -31,32 +34,33 @@ jobs:
exit 0
fi
# sparse
checkout dify-docs repo
# sparse
-
checkout dify-docs repo
git clone --filter=blob:none --sparse $TARGET_REPO dify-docs-sparse
cd dify-docs-sparse
git checkout $TARGET_BRANCH
echo "checked out target branch: $TARGET_BRANCH"
git sparse-checkout set en/tutorials/ zh_CN/tutorials/
# set sparse checked out directories
git sparse-checkout set $TARGET_SECTION_EN $TARGET_SECTION_ZH
echo "set sparse checked out directories of dify-docs repo"
# Sync files to different language directories
for file in $CHANGED_HOWTOS; do
echo "Processing file: $file"
if [[ $file == *"_CN.md" ]]; then
TARGET_DIR=
"zh_CN/tutorials"
TARGET_DIR=
$TARGET_SECTION_ZH
else
TARGET_DIR=
"en/tutorials"
TARGET_DIR=
$TARGET_SECTION_EN
fi
echo "Target directory: $TARGET_DIR"
if [ -f "../$file" ]; then
echo "Copying file to target directory"
cp "../$file" "$TARGET_DIR
/
"
cp "../$file" "$TARGET_DIR"
else
echo "File not found, removing from target directory"
git rm "$TARGET_DIR
/
$(basename $file)" || true
git rm "$TARGET_DIR$(basename $file)" || true
fi
done
...
...
@@ -77,7 +81,7 @@ jobs:
if git push https://${ACCESS_TOKEN}@${TARGET_REPO#https://} HEAD:${TARGET_BRANCH}; then
echo "Files have been successfully pushed to $TARGET_BRANCH branch of $TARGET_REPO"
else
echo "Failed to push files to $TARGET_BRANCH branch of $TARGET_REPO"
echo "Failed to push files to $TARGET_BRANCH branch of $TARGET_REPO
, please manually sync docs
"
exit 1
fi
fi
...
...
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