From 16c4a350fc99c8d632d03886ba91ab21629eed47 Mon Sep 17 00:00:00 2001 From: Arthri <41360489+Arthri@users.noreply.github.com> Date: Fri, 8 Aug 2025 18:47:22 +0800 Subject: [PATCH] Fix !merge_upstream (#30031) * Deprecate tgui bundle merge driver * Fix merge upstream command * Only deprecate merge driver --------- Co-authored-by: Arthri <41360489+a@users.noreply.github.com> --- .gitattributes | 7 ++++-- .github/workflows/merge_upstream_master.yml | 27 +++++++++++++++------ tgui/bin/tgui | 1 + tgui/bin/tgui_.ps1 | 1 + 4 files changed, 27 insertions(+), 9 deletions(-) diff --git a/.gitattributes b/.gitattributes index 3bb0f8b6071..def0de863d8 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,6 +1,9 @@ ## Merge hooks, run tools/hooks/install.bat or install.sh to set up *.dmm text eol=lf merge=dmm *.dmi binary merge=dmi + +## WARNING: DEPRECATED +## Uncomment then run "bash tgui/bin/tgui --install-git-hooks" to activate ## TGUI bundle merge drivers -*.bundle.* binary merge=tgui-merge-bundle -*.chunk.* binary merge=tgui-merge-bundle +*.bundle.* binary # merge=tgui-merge-bundle +*.chunk.* binary # merge=tgui-merge-bundle diff --git a/.github/workflows/merge_upstream_master.yml b/.github/workflows/merge_upstream_master.yml index 410710a4b54..fe1db6e270e 100644 --- a/.github/workflows/merge_upstream_master.yml +++ b/.github/workflows/merge_upstream_master.yml @@ -89,7 +89,6 @@ jobs: # Install Tools chmod +x tools/bootstrap/python bash tools/hooks/install.sh - bash tgui/bin/tgui --install-git-hooks chmod +x tools/hooks/*.merge tgui/bin/tgui # Actual Merge @@ -109,17 +108,31 @@ jobs: fi git merge FETCH_HEAD - git push origin + exit_code=0 + merge_conflicts=$(git diff --name-only --diff-filter=U --exit-code) || exit_code=$? + if [ "$exit_code" -eq 0 ] ; then + exit 0 + else + if grep -v ^tgui/public/ <<< "$merge_conflicts" ; then + gh pr comment ${{ github.event.issue.html_url }} --body "GitHub Actions can not merge upstream into this branch as some conflicted files can not be resolved automatically." + exit 1 + fi + if [[ -n "$(grep ^tgui/public/ <<< "$merge_conflicts")" ]] ; then + echo 'REBUILD_TGUI=true' >>> "$GITHUB_ENV" + fi + fi - name: Rebuild TGUI + if: ${{ env.REBUILD_TGUI }} run: | - if git diff-tree --name-only -r $(git rev-parse HEAD~2) | grep "tgui/public/" ; then - bash tgui/bin/tgui - git commit -m "Rebuild TGUI" + bash tgui/bin/tgui + git merge --continue + + - name: Push Changes + run: | + if [[ -n "$(git rev-list -1 @{u}..)" ]]; then git push origin else - echo "No changes to rebuild TGUI" - fi - name: Notify Failure if: failure() && env.FAIL_NOTIFIED != 'true' diff --git a/tgui/bin/tgui b/tgui/bin/tgui index 713fd39596d..f7d2371389e 100755 --- a/tgui/bin/tgui +++ b/tgui/bin/tgui @@ -114,6 +114,7 @@ task-validate-build() { ## Installs merge drivers and git hooks task-install-git-hooks() { + echo "tgui: WARNING: tgui bundle merge drivers are deprecated. Please modify .gitattributes to continue using them" cd "${base_dir}" local git_root local git_base_dir diff --git a/tgui/bin/tgui_.ps1 b/tgui/bin/tgui_.ps1 index 88ce89d716d..043259aa056 100644 --- a/tgui/bin/tgui_.ps1 +++ b/tgui/bin/tgui_.ps1 @@ -101,6 +101,7 @@ function task-validate-build { ## Installs merge drivers and git hooks function task-install-git-hooks () { + Write-Output "tgui: WARNING: tgui bundle merge drivers are deprecated. Please modify .gitattributes to continue using them" Set-Location $global:basedir git config --replace-all merge.tgui-merge-bundle.driver "tgui/bin/tgui --merge=bundle %P %A" Write-Output "tgui: Merge drivers have been successfully installed!"