Skip to content

Commit 893bf44

Browse files
authored
Update sync-content-to-next.yml
1 parent 11da889 commit 893bf44

File tree

1 file changed

+25
-13
lines changed

1 file changed

+25
-13
lines changed

.github/workflows/sync-content-to-next.yml

+25-13
Original file line numberDiff line numberDiff line change
@@ -91,37 +91,49 @@ jobs:
9191
echo "Files in PR:"
9292
echo "$PR_FILES"
9393
94+
# Flag to track if we found any content files
95+
FOUND_CONTENT_FILES=false
96+
# Create a list of processed files
97+
PROCESSED_FILES=""
98+
9499
# Process content files one by one
95100
echo "Processing content files from PR..."
96-
FOUND_FILES=false
97101
98-
echo "$PR_FILES" | while read -r file; do
102+
while read -r file; do
99103
if [[ "$file" =~ ^docusaurus/docs/cms/ || "$file" =~ ^docusaurus/docs/cloud/ || "$file" =~ ^docusaurus/static/img/assets/ ]]; then
100104
echo "Processing content file: $file"
101105
mkdir -p $(dirname "$file")
102106
git checkout FETCH_HEAD -- "$file"
103-
FOUND_FILES=true
107+
FOUND_CONTENT_FILES=true
108+
PROCESSED_FILES="$PROCESSED_FILES $file"
104109
fi
105-
done
110+
done <<< "$PR_FILES"
106111
107-
# Check if we have changes
108-
if git diff --quiet --exit-code; then
109-
echo "No content files found or no changes detected"
112+
# Exit if no content files were found
113+
if [ "$FOUND_CONTENT_FILES" != "true" ]; then
114+
echo "No content files found in PR"
110115
echo "has_changes=false" >> $GITHUB_OUTPUT
111-
exit 0
112-
else
113-
echo "Changes detected, will commit"
114-
echo "has_changes=true" >> $GITHUB_OUTPUT
116+
exit 0 # Exit with success but skip PR creation
115117
fi
118+
119+
# Debug: Show differences
120+
echo "Showing diffs for processed files:"
121+
for file in $PROCESSED_FILES; do
122+
echo "Diff for $file:"
123+
git diff HEAD -- "$file" || true
124+
done
125+
126+
# Always create PR regardless of detected changes
127+
echo "has_changes=true" >> $GITHUB_OUTPUT
116128
env:
117129
GITHUB_TOKEN: ${{ secrets.SYNC_MAIN_TO_NEXT }}
118130

119131
- name: Commit and create PR
120132
if: steps.apply-changes.outputs.has_changes == 'true'
121133
run: |
122-
# Commit changes
134+
# Commit changes - force commit even if git thinks there are no changes
123135
git add .
124-
git commit -m "Port PR #${{ github.event.pull_request.number }}: ${{ github.event.pull_request.title }} to next branch"
136+
git commit --allow-empty -m "Port PR #${{ github.event.pull_request.number }}: ${{ github.event.pull_request.title }} to next branch"
125137
126138
# Push branch
127139
git push origin next-port-pr${{ github.event.pull_request.number }}

0 commit comments

Comments
 (0)