Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
313 commits
Select commit Hold shift + click to select a range
86091b7
properly set CMDER_ROOT for windows terminal bash
daxgames Nov 12, 2023
9a40419
Merge pull request #2896 from daxgames/more_speed_2
DRSDavidSoft Nov 21, 2023
8025b5b
Merge branch 'development' into windows_terminal
DRSDavidSoft Nov 21, 2023
e01a553
Merge pull request #2897 from daxgames/windows_terminal
DRSDavidSoft Nov 21, 2023
f0c18f1
Update Cmder.bat
daxgames Nov 23, 2023
f8aa7fe
PR - Requested Changes
daxgames Nov 23, 2023
08fd69b
PR - Requested Changes
daxgames Nov 23, 2023
26e684f
PR - Requested Changes
daxgames Nov 23, 2023
30718ab
Merge remote-tracking branch 'origin/windows_terminal' into windows_t…
daxgames Nov 23, 2023
016846d
Merge remote-tracking branch 'origin/windows_terminal' into development
daxgames Nov 23, 2023
67b6278
add cmder slim
daxgames Nov 23, 2023
99b4e66
add Cmder for win
daxgames Nov 24, 2023
3c2a25a
cleanup
daxgames Nov 24, 2023
5c101a0
remove small typo
DRSDavidSoft Nov 24, 2023
e2303b1
add cmder slim (i.e. option for no bundled terminal)
DRSDavidSoft Nov 24, 2023
9ce6911
add bash and powershell to Cmder for Windows
daxgames Nov 24, 2023
467d564
cleanup
daxgames Nov 24, 2023
3ff9737
Merge remote-tracking branch 'origin/development' into development
daxgames Nov 24, 2023
a7f19f5
cleanup
daxgames Nov 24, 2023
2beb27d
cleanup
daxgames Nov 24, 2023
0f6c91d
cleanup
daxgames Nov 24, 2023
7a385eb
cleanup
daxgames Nov 24, 2023
0a691cb
Merge remote-tracking branch 'upstream/development' into development
daxgames Nov 24, 2023
d8238b0
cleanup
daxgames Nov 24, 2023
4729203
add mintty
daxgames Nov 27, 2023
38a91de
cleanup
daxgames Nov 27, 2023
28e9018
make mintty /a work
daxgames Nov 27, 2023
6e21311
Merge branch 'more_speed_2' of https://github.com/daxgames/cmder into…
daxgames Nov 27, 2023
131949b
Merge branch 'master' into development
MartiUK Dec 20, 2023
c5579d2
Add Monokai, Default to One Half Dark
daxgames Jan 2, 2024
1ed3a36
Update windows_terminal_default_settings.json
daxgames Jan 2, 2024
5814792
Merge pull request #15 from daxgames/development-dax
daxgames Jan 2, 2024
d68c5b4
Merge pull request #2909 from cmderdev/master
DRSDavidSoft Apr 26, 2024
aac7cfc
Fix GitHub action (merge master into development)
DRSDavidSoft May 21, 2024
5d80371
Merge remote-tracking branch 'upstream/development' into development-dax
daxgames May 22, 2024
9ce8238
Update Windows Terminal to 1.20.11271.0
daxgames May 22, 2024
92c662d
Merge branch 'master' into development
DRSDavidSoft May 23, 2024
546d921
Merge branch 'master' into development
DRSDavidSoft May 28, 2024
41ac761
Update Windows Terminal
daxgames May 28, 2024
6692331
Merge remote-tracking branch 'upstream/development' into development-dax
daxgames May 29, 2024
2b05b3a
Update Windows Terminal default settings
daxgames May 30, 2024
23b2a86
Update Windows terminal default settings
daxgames May 30, 2024
0643c6f
Update Windows terminal default settings
daxgames May 30, 2024
881938e
Update Windows Terminal default settings and version
daxgames May 30, 2024
db3889d
remove vendor/start_git_mintty.cmd
daxgames May 30, 2024
e850f82
add vendor/start_git_mintty.cmd
daxgames May 30, 2024
c594642
update build workflow to upload cmder_win.zip
daxgames May 30, 2024
9463d4e
update build workflow to upload cmder_win*
daxgames May 30, 2024
9120d92
Merge pull request #2943 from daxgames/new_wt
daxgames May 30, 2024
167f57b
Merge branch 'upstream-development' into cmder4win
daxgames May 30, 2024
f38e0b3
sync
daxgames May 30, 2024
e457afa
Merge branch 'master' into development
DRSDavidSoft May 31, 2024
fe4f460
Merge remote-tracking branch 'upstream/development' into development-dax
daxgames May 31, 2024
2e945fb
Fix launcher overwritting/backing up emulator settings
daxgames May 31, 2024
339e6b4
Merge branch 'master' into development
DRSDavidSoft Jun 6, 2024
e84f2ff
Merge branch 'master' into development
DRSDavidSoft Jul 27, 2024
3feebbc
Merge branch 'upstream_development' into development-dax
daxgames Aug 3, 2024
82ab068
cleanup
daxgames Aug 15, 2024
85fcef1
Merge remote-tracking branch 'origin/fix_launcher_overwrite' into dev…
daxgames Aug 20, 2024
8e44daf
Sync
daxgames Aug 20, 2024
f4f6255
remove extra {}
daxgames Aug 20, 2024
ffa37d4
sync fix launcher overwrite
daxgames Aug 22, 2024
376981a
x
daxgames Aug 22, 2024
d047236
x
daxgames Aug 22, 2024
fbd4c04
Merge branch 'master' into development
DRSDavidSoft Oct 14, 2024
4740b83
adjust indentation and merge from main
DRSDavidSoft Oct 17, 2024
9b466e3
merge changes from master
DRSDavidSoft Oct 17, 2024
940cadc
Merge branch 'master' into development
DRSDavidSoft Oct 17, 2024
cc40343
Merge branch 'master' into development
DRSDavidSoft Nov 13, 2024
d15e7ac
cleanup
DRSDavidSoft Nov 13, 2024
5d0699a
Merge branch 'development' of https://github.com/cmderdev/cmder into …
DRSDavidSoft Nov 13, 2024
b140db4
Merge branch 'development' of https://github.com/cmderdev/cmder into …
DRSDavidSoft Nov 13, 2024
6c95424
Merge branch 'development' of https://github.com/cmderdev/cmder into …
DRSDavidSoft Nov 13, 2024
f11b1cb
x
daxgames Dec 22, 2024
1c77c92
Merge remote-tracking branch 'upstream/master' into development-dax
daxgames Dec 29, 2024
246711a
Merge remote-tracking branch 'upstream/development' into development-dax
daxgames Dec 29, 2024
ebce847
origin/fix_launcher_overwrite
daxgames Dec 29, 2024
b0d59c9
Merge branch 'fix_launcher_overwrite' into development-dax
daxgames Dec 29, 2024
8ea276d
not set
daxgames Jan 2, 2025
36ea619
not set
daxgames Jan 2, 2025
9b5be7b
cleanup
daxgames Jan 2, 2025
05f616f
cleanup
daxgames Jan 2, 2025
74d7dd2
cleanup
daxgames Jan 2, 2025
a9f8707
Merge branch 'fix_launcher_overwrite-2' into development-dax
daxgames Jan 2, 2025
a1a6a02
Merge pull request #2825 from daxgames/more_speed_2
daxgames Jan 5, 2025
980083f
Merge pull request #23 from daxgames/more_speed_2
daxgames Jan 5, 2025
6cf4a42
Merge pull request #24 from daxgames/fix_launcher_overwrite-2
daxgames Jan 5, 2025
bd3f132
Merge branch 'origin-development-dax' into cmder4win
daxgames Jan 5, 2025
0c2e5ce
CHANGELOG.md
daxgames Jan 6, 2025
b00dce8
Merge remote-tracking branch 'origin/cmder4win' into cmder4win
daxgames Jan 6, 2025
e0aa20a
CHANGELOG.md
daxgames Jan 6, 2025
0634969
CHANGELOG.md
daxgames Jan 6, 2025
b412036
CHANGELOG.md
daxgames Jan 6, 2025
d349f57
add executionpolicy bypass
daxgames Jan 6, 2025
8683dad
Remove /a switch and associated code.
daxgames Jan 6, 2025
15d5618
Merge pull request #2988 from daxgames/fix_launcher_overwrite-2
daxgames Jan 6, 2025
c1bbc46
Merge branch 'upstream-development' into cmder4win
daxgames Jan 6, 2025
7ac805c
Merge pull request #2942 from daxgames/cmder4win
daxgames Mar 9, 2025
6d82cf8
fix build script
daxgames Apr 3, 2025
a44b30c
Update build.yml
daxgames Apr 3, 2025
e3fc1a1
Merge branch 'master' into development
DRSDavidSoft Apr 8, 2025
8b004be
Merge branch 'master' into development
DRSDavidSoft Apr 8, 2025
2868f9e
revert inadvertent changes
daxgames Apr 8, 2025
df42ff2
indentation cleanup and comment fix
DRSDavidSoft Apr 8, 2025
aa156a2
revert inadvertent changes
DRSDavidSoft Apr 8, 2025
76c5b9e
resolve conflicts
DRSDavidSoft Jul 15, 2025
bb14aea
merge with master
DRSDavidSoft Jul 15, 2025
cf97d7d
Merge branch 'master' into development
DRSDavidSoft Jul 15, 2025
623bd52
Merge branch 'master' into development
DRSDavidSoft Jul 16, 2025
e52906a
Merge branch 'master' into development
DRSDavidSoft Jul 16, 2025
e2784bc
Bump actions/checkout from 4 to 5
DRSDavidSoft Aug 12, 2025
b1b9bd2
Merge branch 'master' into development
DRSDavidSoft Nov 6, 2025
66747a1
Merge branch 'master' into development
DRSDavidSoft Nov 6, 2025
d45651f
Merge branch 'master' of https://github.com/cmderdev/cmder into devel…
DRSDavidSoft Nov 6, 2025
4886f61
Merge branch 'development' of https://github.com/cmderdev/cmder into …
DRSDavidSoft Nov 6, 2025
2f148fb
Merge branch 'master' into development
DRSDavidSoft Nov 6, 2025
f9a4b0d
Merge branch 'master' into development
DRSDavidSoft Nov 6, 2025
f6eb7aa
Improve path enhancement handling in lib_path.cmd
DRSDavidSoft Nov 6, 2025
2786942
fix typo
DRSDavidSoft Nov 6, 2025
375f63a
fix indentation
DRSDavidSoft Nov 6, 2025
76711b4
improve consistency
DRSDavidSoft Nov 6, 2025
b522c13
Merge branch 'master' into development
DRSDavidSoft Nov 6, 2025
74b3f18
Merge pull request #3037 from mbotezatu/master
DRSDavidSoft Nov 7, 2025
d4433f8
Merge branch 'master' into development
DRSDavidSoft Nov 7, 2025
f6bf29d
Merge branch 'master' into development
DRSDavidSoft Nov 7, 2025
71b648f
Merge branch 'master' into development
DRSDavidSoft Nov 7, 2025
a0a5b2c
Merge branch 'master' into development
DRSDavidSoft Nov 7, 2025
85c0824
merge with master
DRSDavidSoft Nov 7, 2025
09ab2f2
Merge branch 'master' into development
DRSDavidSoft Nov 8, 2025
36670ea
Merge branch 'master' into development
DRSDavidSoft Nov 8, 2025
3ca3b9f
Merge branch 'master' of https://github.com/cmderdev/cmder into devel…
DRSDavidSoft Nov 8, 2025
bf7d516
Merge branch 'development' of https://github.com/cmderdev/cmder into …
DRSDavidSoft Nov 8, 2025
b0ab14d
Ignore whitespace-only .ps1 commits in blame
DRSDavidSoft Nov 8, 2025
081e818
Ignore whitespace-only .cmd commits in blame
DRSDavidSoft Nov 8, 2025
f91d0bd
Refactor .git-blame-ignore-revs for clarity
DRSDavidSoft Nov 8, 2025
96f0bc9
ignore commit
DRSDavidSoft Nov 8, 2025
d900f6a
Merge branch 'master' into development
DRSDavidSoft Nov 8, 2025
a571eed
Merge branch 'master' into development
DRSDavidSoft Nov 8, 2025
842393a
Merge branch 'master' into development
DRSDavidSoft Nov 8, 2025
e2fcb1c
Merge branch 'master' into development
DRSDavidSoft Nov 8, 2025
1b03e29
Merge branch 'master' into development
DRSDavidSoft Nov 8, 2025
9030e7a
Merge branch 'master' into development
DRSDavidSoft Nov 9, 2025
d001d91
Merge branch 'master' into development
DRSDavidSoft Nov 9, 2025
f67e570
resolve conflicts
DRSDavidSoft Nov 9, 2025
5536ea2
ignore git commit
DRSDavidSoft Nov 9, 2025
105ff01
resolve conflicts
DRSDavidSoft Nov 9, 2025
7bb7678
Merge branch 'master' into development
DRSDavidSoft Nov 9, 2025
480b638
Merge branch 'master' into development
DRSDavidSoft Nov 9, 2025
8fa1d2e
Merge remote-tracking branch 'upstream/development' into development-dax
daxgames Nov 27, 2025
974f5b0
spacing
daxgames Nov 27, 2025
13904e4
Merge pull request #3053 from daxgames/cmder-micro-tasks
daxgames Nov 27, 2025
f461904
Merge pull request #3034 from cmderdev/pr/lib_path
daxgames Nov 27, 2025
039e7d2
Merge branch 'master' into upstream-development
daxgames Feb 22, 2026
884165d
Merge branch 'master' into development
daxgames Feb 22, 2026
54b96df
sync master and CHANGELOG.md updates
daxgames Feb 22, 2026
d8c52c4
Merge branch 'master' into development
daxgames Feb 22, 2026
dc99548
Merge branch 'upstream-master' into upstream-development
daxgames Feb 22, 2026
0550f36
Merge branch 'master' into development
daxgames Feb 22, 2026
306dffa
cleanup and fixes
daxgames Jun 7, 2026
0fe6842
x
daxgames Jun 7, 2026
dd1d167
Initial plan
Copilot Jun 14, 2026
4d0ccb0
fix: add build-mode: manual, update setup-msbuild to v3, use -NoVendo…
Copilot Jun 14, 2026
b73d7df
Merge pull request #3085 from cmderdev/copilot/fix-analyze-cpp-job
daxgames Jun 14, 2026
d25aa76
more consistent path creation between shells
daxgames Jun 14, 2026
5fc9e0b
Merge remote-tracking branch 'upstream/copilot/fix-analyze-cpp-job' i…
daxgames Jun 14, 2026
213d6a1
Merge branch 'master' of https://github.com/cmderdev/cmder into devel…
DRSDavidSoft Jun 14, 2026
6793c5a
cleanup
daxgames Jun 14, 2026
8c40ddd
Merge remote-tracking branch 'upstream/development' into init-bat-cle…
daxgames Jun 14, 2026
80f3441
more consistent path setting accros shells
daxgames Jun 14, 2026
515db0c
cleanup
daxgames Jun 14, 2026
aca331f
cleanup
daxgames Jun 14, 2026
8989d2d
Merge pull request #3082 from daxgames/init-bat-cleanup
daxgames Jun 14, 2026
4347d13
Merge branch 'master' into development
DRSDavidSoft Jun 14, 2026
a51ee20
Make Windows Terminal the default terminal
daxgames Jun 14, 2026
c314d56
Fix workflow summary markdown tables
DRSDavidSoft Jun 14, 2026
f09be1b
Make Windows Terminal the default terminal
daxgames Jun 14, 2026
8813f31
Merge branch 'master' into development
DRSDavidSoft Jun 14, 2026
bc27a30
Merge branch 'master' into development
DRSDavidSoft Jun 14, 2026
1e9a47d
Merge development into packaging profiles
DRSDavidSoft Jun 14, 2026
9c1159e
Merge pull request #3090 from daxgames/wt_default
DRSDavidSoft Jun 14, 2026
93d3c78
Merge branch 'master' into development
DRSDavidSoft Jun 14, 2026
9f9d01b
Merge remote-tracking branch 'origin/development' into development
DRSDavidSoft Jun 14, 2026
afea84a
Normalize terminal flag casing
DRSDavidSoft Jun 14, 2026
3693b31
Restore workflow summary comments
DRSDavidSoft Jun 14, 2026
c013848
Add scripts/README.me
daxgames Jun 14, 2026
261e3d3
Add scripts/README.me
daxgames Jun 14, 2026
b299c9a
Move verbose to end of command
DRSDavidSoft Jun 14, 2026
3271c39
cleanup
daxgames Jun 14, 2026
f8cf2ca
cleanup
daxgames Jun 14, 2026
9cd0734
refactor packaging profiles
DRSDavidSoft Jun 14, 2026
21fb7c1
Use upload-artifact v7
DRSDavidSoft Jun 14, 2026
910ad8f
Normalize -Verbose placement
DRSDavidSoft Jun 14, 2026
b6bbdee
Rename cmder_win profile to cmder_slim
DRSDavidSoft Jun 14, 2026
d832aef
Restore emoji-rich build summary
DRSDavidSoft Jun 14, 2026
6ce9489
Restore per-file artifact links
DRSDavidSoft Jun 14, 2026
2ffec6b
Fix vendor PR summary fallback
DRSDavidSoft Jun 14, 2026
9c3564d
Keep vendor fallback on protected branch push failure
DRSDavidSoft Jun 14, 2026
351d177
Switch package profiles to included vendors
DRSDavidSoft Jun 14, 2026
e1a71f7
Link workflow summary row to build file
DRSDavidSoft Jun 14, 2026
1bcfc71
Drive package variants from JSON config
DRSDavidSoft Jun 14, 2026
076bcfc
Normalize ConEmu task names
DRSDavidSoft Jun 14, 2026
244e021
Merge branch 'master' into development
DRSDavidSoft Jun 14, 2026
24beabb
Link update-vendor branch in summary
DRSDavidSoft Jun 14, 2026
d7e04c3
Merge branch 'master' into development
DRSDavidSoft Jun 14, 2026
3085d90
Merge branch 'master' into development
DRSDavidSoft Jun 14, 2026
2e10a34
Normalize casing in PowerShell helpers
DRSDavidSoft Jun 14, 2026
9e3e8e4
Fix casing
DRSDavidSoft Jun 14, 2026
cb0df18
Restore per-file artifact uploads
DRSDavidSoft Jun 14, 2026
ece1948
Restore per-file artifact links
DRSDavidSoft Jun 14, 2026
5531447
Fix artifact links in build summary
DRSDavidSoft Jun 15, 2026
ff33e02
Add branch metadata to build summary
DRSDavidSoft Jun 15, 2026
343cb15
Add build branch notices
DRSDavidSoft Jun 15, 2026
7fd9b3d
Fix vendor PR summary newline
DRSDavidSoft Jun 19, 2026
1ed09e7
Merge remote-tracking branch 'origin/master' into HEAD
DRSDavidSoft Jun 19, 2026
4cdd7af
Merge master into development
DRSDavidSoft Jun 19, 2026
8155738
Fix Windows PowerShell build script parsing
DRSDavidSoft Jun 19, 2026
2a11c30
Merge master into development
DRSDavidSoft Jun 19, 2026
471808d
Address build script review cleanup
DRSDavidSoft Jun 19, 2026
6e277c3
Align cmd init naming and generated template
DRSDavidSoft Jun 20, 2026
d34f6b2
Update tests workflow for init.cmd rename
DRSDavidSoft Jun 20, 2026
3ff9582
Honor nested init guard in generated cmd config
DRSDavidSoft Jun 20, 2026
3c08b7c
Guard cmd init migration in tests
DRSDavidSoft Jun 20, 2026
25ee158
Create init.bat compatibility shim
DRSDavidSoft Jun 20, 2026
fea0d2f
Expand development changelog
DRSDavidSoft Jun 20, 2026
0d9699d
Apply PR 3015 script cleanups to development
DRSDavidSoft Jun 20, 2026
6e5b91f
revert unnecessary changes.
daxgames Jun 21, 2026
197e448
fixes
daxgames Jun 21, 2026
d280086
cleanup
daxgames Jun 21, 2026
b675c79
cleanup
daxgames Jun 21, 2026
98cc719
cleanup
daxgames Jun 21, 2026
dc0be22
Merge master into development
DRSDavidSoft Jun 30, 2026
077ff68
Merge master into development
DRSDavidSoft Jun 30, 2026
66babe5
Fix build error.
daxgames Jul 4, 2026
101b7d3
Better backward compatibility when migrating init.bat to init.cmd.
daxgames Jul 4, 2026
dced546
Merge pull request #3096 from daxgames/revert-template-changes
daxgames Jul 4, 2026
4c47916
Merge remote-tracking branch 'upstream/development' into upstream-dev…
daxgames Jul 4, 2026
2d08bff
Merge pull request #3104 from cmderdev/init_cmd_compatibility
daxgames Jul 4, 2026
d4e7b4e
sync with master
daxgames Jul 8, 2026
47808e4
x
daxgames Jul 8, 2026
1de9b26
x
daxgames Jul 8, 2026
b3e17fc
sync master
daxgames Jul 8, 2026
783e0e6
Rename slim package to Cmder Launcher
DRSDavidSoft Jul 9, 2026
51c3f9b
Harden development branch sync workflow
DRSDavidSoft Jul 9, 2026
1d537a1
Merge master into development
DRSDavidSoft Jul 9, 2026
03922bc
Explain branch sync merge failures
DRSDavidSoft Jul 9, 2026
6f144e9
Fix CI workflow artifact and shim checks
DRSDavidSoft Jul 11, 2026
6cf3995
Polish PowerShell script syntax
DRSDavidSoft Jul 11, 2026
0d65751
Merge remote-tracking branch 'origin/master' into development
DRSDavidSoft Jul 11, 2026
2b3ac81
Merge remote-tracking branch 'origin/master' into development
DRSDavidSoft Jul 11, 2026
3aa1d8e
Merge branch 'master' into development
DRSDavidSoft Jul 11, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
263 changes: 260 additions & 3 deletions .github/workflows/branches.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

concurrency:
group: update-development
cancel-in-progress: false

permissions:
actions: write
contents: write
Expand All @@ -25,7 +29,9 @@ jobs:
# Checks-out the repository under $GITHUB_WORKSPACE, so the job can access it
- uses: actions/checkout@v7
with:
ref: development
fetch-depth: 0 # fetch all history for all branches and tags
token: ${{ secrets.BRANCH_SYNC_TOKEN || github.token }}

- name: Summary - Merge operation started
shell: bash
Expand Down Expand Up @@ -55,12 +61,119 @@ jobs:

# Runs a single command using the runners shell
- name: Merge master into development
shell: bash
env:
HAS_BRANCH_SYNC_TOKEN: ${{ secrets.BRANCH_SYNC_TOKEN != '' }}
run: |
set -euo pipefail

failure_log="$RUNNER_TEMP/branch-sync-failure.log"
short_diff_file="$RUNNER_TEMP/branch-sync-short-diff.txt"
last_command_file="$RUNNER_TEMP/branch-sync-last-command.txt"
command_log="$RUNNER_TEMP/branch-sync-commands.log"
: > "$failure_log"
: > "$short_diff_file"
: > "$last_command_file"
: > "$command_log"

quote_command() {
local quoted=""
local arg
for arg in "$@"; do
printf -v quoted_arg "%q" "$arg"
quoted+="${quoted_arg} "
done
printf "%s" "${quoted% }"
}

capture_short_diff() {
local diff_file="$1"
local max_lines=180
local tmp_file

tmp_file="$(mktemp)"

{
echo "## git status --short"
git status --short || true
echo ""

mapfile -t unmerged_files < <(git diff --name-only --diff-filter=U 2>/dev/null || true)
if [[ "${#unmerged_files[@]}" -gt 0 ]]; then
echo "## conflict diff"
git diff --cc -- "${unmerged_files[@]}" || true
elif ! git diff --quiet -- . 2>/dev/null; then
echo "## worktree diff"
git diff -- . || true
elif ! git diff --cached --quiet -- . 2>/dev/null; then
echo "## staged diff"
git diff --cached -- . || true
elif git rev-parse --verify origin/development >/dev/null 2>&1 && ! git diff --quiet origin/development HEAD -- . 2>/dev/null; then
echo "## branch diff against origin/development"
git diff --stat origin/development HEAD -- . || true
echo ""
git diff --patch --find-renames origin/development HEAD -- . || true
else
echo "No local or branch diff was available after the failure."
fi
} > "$tmp_file"

sed -n "1,${max_lines}p" "$tmp_file" > "$diff_file"
if [[ "$(wc -l < "$tmp_file")" -gt "$max_lines" ]]; then
echo "" >> "$diff_file"
echo "[diff truncated after ${max_lines} lines]" >> "$diff_file"
fi

rm -f "$tmp_file"
}

run_command() {
local command_display
local output
local status

command_display="$(quote_command "$@")"
printf "%s\n" "$command_display" > "$last_command_file"
printf "$ %s\n" "$command_display" >> "$command_log"

set +e
output="$("$@" 2>&1)"
status=$?
set -e

if [[ -n "$output" ]]; then
printf "%s\n" "$output"
printf "%s\n" "$output" >> "$command_log"
fi

if [[ "$status" -ne 0 ]]; then
{
printf "Command: %s\n" "$command_display"
printf "Exit code: %s\n" "$status"
printf "\n"
printf "%s\n" "$output"
} > "$failure_log"
capture_short_diff "$short_diff_file"
return "$status"
fi
}

git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
git checkout development
git merge --no-ff master
git push origin development
run_command git fetch origin master development
run_command git checkout -B development origin/development
run_command git reset --hard origin/development
run_command git clean -fdx
run_command git merge --no-ff origin/master

if git diff --name-only origin/development HEAD | grep -q '^\.github/workflows/'; then
echo "This merge updates workflow files. Configure a BRANCH_SYNC_TOKEN secret with workflow scope so GitHub accepts the sync push." >> "$GITHUB_STEP_SUMMARY"
if [[ "$HAS_BRANCH_SYNC_TOKEN" != "true" ]]; then
echo "::warning::This merge updates workflow files, but BRANCH_SYNC_TOKEN is not configured. GitHub may reject the push because GITHUB_TOKEN cannot update workflow files."
fi
fi

run_command git push origin HEAD:development

- name: Summary - Merge completed
if: success()
Expand All @@ -77,3 +190,147 @@ jobs:
echo "**Merge type:** No fast-forward merge" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "> The [\`development\`]($target_branch_url) branch is now synchronized with the latest changes from [\`master\`]($source_branch_url)." >> $GITHUB_STEP_SUMMARY

- name: Summary - Merge failed
if: failure()
shell: bash
run: |
failure_log="$RUNNER_TEMP/branch-sync-failure.log"
short_diff_file="$RUNNER_TEMP/branch-sync-short-diff.txt"
command_log="$RUNNER_TEMP/branch-sync-commands.log"

extract_reason() {
local log_file="$1"
if [[ ! -s "$log_file" ]]; then
printf "No command stderr/stdout was captured. Open the failed step log for the raw runner output."
return
fi

awk '
/error:|fatal:|CONFLICT|Aborting|refusing to allow|rejected|would be overwritten|Please commit your changes|Merge with strategy|non-fast-forward|fetch first|Permission denied|not authorized|workflow scope/ {
print
}
' "$log_file"
}

add_suggestions() {
local log_text="$1"

if [[ "$log_text" =~ "would be overwritten by merge" || "$log_text" =~ "Please commit your changes or stash them before you merge" ]]; then
cat <<'EOF'
```bash
git fetch origin master development
git checkout development
git status --short
git diff
git restore --worktree --staged <file-from-error>
git merge --no-ff origin/master
git push origin development
```
EOF
return
fi

if [[ "$log_text" =~ "refusing to allow a GitHub App to create or update workflow" ]]; then
cat <<'EOF'
```bash
# Create a fine-grained PAT that can write Contents and Workflows,
# then save it as the repository secret BRANCH_SYNC_TOKEN.
gh secret set BRANCH_SYNC_TOKEN --repo cmderdev/cmder

# After the secret is configured, rerun the failed branch-sync workflow.
gh run rerun ${{ github.run_id }} --repo ${{ github.repository }} --failed
```
EOF
return
fi

if [[ "$log_text" =~ "non-fast-forward" || "$log_text" =~ "fetch first" ]]; then
cat <<'EOF'
```bash
git fetch origin master development
git checkout development
git merge --no-ff origin/master
git push origin development
```
EOF
return
fi

if [[ "$log_text" =~ "CONFLICT" ]]; then
cat <<'EOF'
```bash
git fetch origin master development
git checkout development
git merge --no-ff origin/master
git status
# Resolve the conflicted files, then:
git add <resolved-files>
git commit
git push origin development
```
EOF
return
fi

cat <<'EOF'
```bash
git fetch origin master development
git checkout development
git merge --no-ff origin/master
git status
```
EOF
}

log_text=""
if [[ -s "$failure_log" ]]; then
log_text="$(cat "$failure_log")"
fi

reason="$(extract_reason "$failure_log" | sed '/^[[:space:]]*$/d')"
if [[ -z "$reason" && -n "$log_text" ]]; then
reason="$log_text"
fi

echo "### ❌ Merge Failed" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
echo "**Failed command:**" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
echo '```bash' >> "$GITHUB_STEP_SUMMARY"
if [[ -s "$failure_log" ]]; then
sed -n 's/^Command: //p' "$failure_log" | head -n 1 >> "$GITHUB_STEP_SUMMARY"
else
echo "Unknown; failure happened before command capture was initialized." >> "$GITHUB_STEP_SUMMARY"
fi
echo '```' >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
echo "**Extracted reason:**" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
echo '```text' >> "$GITHUB_STEP_SUMMARY"
printf "%s\n" "$reason" >> "$GITHUB_STEP_SUMMARY"
echo '```' >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
echo "**Suggested fix commands:**" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
add_suggestions "$log_text" >> "$GITHUB_STEP_SUMMARY"

if [[ -s "$short_diff_file" ]]; then
echo "" >> "$GITHUB_STEP_SUMMARY"
echo "**Short relevant diff:**" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
echo '```diff' >> "$GITHUB_STEP_SUMMARY"
cat "$short_diff_file" >> "$GITHUB_STEP_SUMMARY"
echo '```' >> "$GITHUB_STEP_SUMMARY"
fi

if [[ -s "$command_log" ]]; then
echo "" >> "$GITHUB_STEP_SUMMARY"
echo "<details><summary>Captured command output</summary>" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
echo '```text' >> "$GITHUB_STEP_SUMMARY"
cat "$command_log" >> "$GITHUB_STEP_SUMMARY"
echo '```' >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
echo "</details>" >> "$GITHUB_STEP_SUMMARY"
fi
Loading
Loading