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
6f998a91
Commit
6f998a91
authored
Jan 22, 2024
by
chenhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add check for empty commit
parent
4a26d2ae
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
14 deletions
+20
-14
sync-howto-docs.yml
.github/workflows/sync-howto-docs.yml
+20
-14
No files found.
.github/workflows/sync-howto-docs.yml
View file @
6f998a91
...
...
@@ -21,12 +21,12 @@ jobs:
TARGET_BRANCH
:
'
test-howto-sync'
ACCESS_TOKEN
:
${{ secrets.DIFY_DOCS_ACCESS_TOKEN }}
run
:
|
CHANGED_
FILES=$(git diff
--name-only --diff-filter=AMDR ${{ github.event.before }}..${{ github.event.after }} | grep -e 'howto-.*\.md$' || true)
CHANGED_
HOWTOS=$(git diff --no-renames
--name-only --diff-filter=AMDR ${{ github.event.before }}..${{ github.event.after }} | grep -e 'howto-.*\.md$' || true)
echo "Changed files:"
echo "$CHANGED_
FILE
S"
echo "Changed
how-to
files:"
echo "$CHANGED_
HOWTO
S"
if [ -z "$CHANGED_
FILE
S" ]; then
if [ -z "$CHANGED_
HOWTO
S" ]; then
echo "No new how-to file changes to sync"
exit 0
fi
...
...
@@ -36,14 +36,13 @@ jobs:
cd dify-docs-sparse
git checkout $TARGET_BRANCH
echo "checked out target branch"
echo "Current branch: $TARGET_BRANCH"
echo "checked out target branch: $TARGET_BRANCH"
git sparse-checkout set en/tutorials/ zh_CN/tutorials/
echo "set sparse checked out directories of dify-docs repo"
# Sync files to different language directories
for file in $CHANGED_
FILE
S; do
for file in $CHANGED_
HOWTO
S; do
echo "Processing file: $file"
if [[ $file == *"_CN.md" ]]; then
TARGET_DIR="zh_CN/tutorials"
...
...
@@ -63,15 +62,22 @@ jobs:
git config user.name github-actions
git config user.email github-actions@github.com
git add .
git commit -m "Sync how-to markdown files from PR #${{ github.event.pull_request.number }} on main repo"
git add --all
echo "Pushing files to $TARGET_BRANCH branch of $TARGET_REPO"
GIT_STATUS=$(git status --porcelain)
echo "staged changes: $GIT_STATUS"
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
"
if
[ -z "$GIT_STATUS" ]
; then
echo "
Nothing to commit, skipping push
"
else
echo "Failed to push files to $TARGET_BRANCH branch of $TARGET_REPO"
exit 1
git commit -m "Sync how-to markdown files from PR #${{ github.event.pull_request.number }} on main repo"
echo "Pushing files to $TARGET_BRANCH branch of $TARGET_REPO"
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"
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