Skip to content

Commit e23eddd

Browse files
authored
fixing conflict
Keep all existing changes Create a merge commit if there are conflicts Preserve the commit history of both branches Include all changes in the final push
1 parent 9ae56fb commit e23eddd

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

.github/workflows/validate_and_fix_markdown.yml

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ jobs:
1818
uses: actions/checkout@v4
1919
with:
2020
fetch-depth: 0
21+
ref: ${{ github.head_ref || github.ref_name }}
2122

2223
- name: Set up Node.js
2324
uses: actions/setup-node@v3
@@ -35,12 +36,23 @@ jobs:
3536
git config --global user.email "github-actions[bot]@users.noreply.github.com"
3637
git config --global user.name "github-actions[bot]"
3738
38-
- name: Commit and rebase changes
39+
- name: Commit and merge changes
3940
env:
4041
PR_BRANCH: ${{ github.head_ref || github.ref_name }}
42+
GIT_AUTHOR_NAME: github-actions[bot]
43+
GIT_AUTHOR_EMAIL: github-actions[bot]@users.noreply.github.com
44+
GIT_COMMITTER_NAME: github-actions[bot]
45+
GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com
4146
run: |
42-
git pull origin "$PR_BRANCH" || echo "Failed to pull latest changes"
47+
# Ensure we're on the correct branch
48+
git switch -c "$PR_BRANCH" || git switch "$PR_BRANCH"
49+
50+
# Stage and commit changes if any
4351
git add -A
44-
git commit -m "Fix Markdown syntax issues" || echo "No changes to commit"
45-
git pull --rebase origin "$PR_BRANCH" || echo "No rebase needed"
46-
git push origin HEAD:"$PR_BRANCH"
52+
git diff --staged --quiet || git commit -m "Fix Markdown syntax issues"
53+
54+
# Pull and merge existing changes
55+
git pull origin "$PR_BRANCH" --no-rebase
56+
57+
# Push all changes
58+
git push origin "$PR_BRANCH"

0 commit comments

Comments
 (0)