Skip to content

Commit e28e790

Browse files
committed
fix(git): fix ue submodule update github action
1 parent b44909e commit e28e790

File tree

1 file changed

+22
-9
lines changed

1 file changed

+22
-9
lines changed

.github/workflows/UpdateUESubmodule.yml

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ name: Update UE Submodule and PR
33
on:
44
workflow_dispatch:
55

6-
env:
7-
COMMITS_BODY: ''
8-
96
jobs:
107
update-submodule:
118
permissions: write-all
@@ -30,12 +27,28 @@ jobs:
3027
run: |
3128
cd ./deps/first/Unreal
3229
git fetch origin main
33-
git log HEAD..main --pretty="tformat:* %s (**%an**) _%h_" >> submodule-commits.txt
34-
body=$(cat submodule-commits.txt)
35-
body="${body//'%'/'%25'}"
36-
body="${body//$'\n'/'%0A'}"
37-
body="${body//$'\r'/'%0D'}"
38-
echo "COMMITS_BODY=$body" >> $GITHUB_ENV
30+
31+
# Get the remote URL to extract owner/repo
32+
REMOTE_URL=$(git config --get remote.origin.url)
33+
# Extract owner/repo from the URL (works for both HTTPS and SSH)
34+
if [[ $REMOTE_URL == [email protected]:* ]]; then
35+
REPO_PATH=${REMOTE_URL#[email protected]:}
36+
REPO_PATH=${REPO_PATH%.git}
37+
else
38+
REPO_PATH=${REMOTE_URL#https://github.com/}
39+
REPO_PATH=${REPO_PATH%.git}
40+
fi
41+
42+
# Generate commit list with proper PR links
43+
git log HEAD..main --pretty="tformat:* %s (**%an**) _%h_" | \
44+
sed "s/#\([0-9]\+\)/[#\1](https:\/\/github.com\/${REPO_PATH}\/pull\/\1)/g" > submodule-commits.txt
45+
46+
# Read the file content and save to environment variable
47+
{
48+
echo 'COMMITS_BODY<<EOF'
49+
cat submodule-commits.txt
50+
echo EOF
51+
} >> $GITHUB_ENV
3952
4053
- name: Update submodule to latest commit on main branch
4154
run: |

0 commit comments

Comments
 (0)