-
Notifications
You must be signed in to change notification settings - Fork 399
70 lines (58 loc) · 2.24 KB
/
UpdateUESubmodule.yml
File metadata and controls
70 lines (58 loc) · 2.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: Update UE Submodule and PR
on:
workflow_dispatch:
jobs:
update-submodule:
permissions: write-all
runs-on: ubuntu-latest
steps:
- name: Setup github SSH for UEPseudo
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.UEPSEUDO_SSH_KEY }}
known_hosts: unnecessary
- name: Checkout
uses: actions/checkout@v4
- name: Initialize submodule
run: |
git submodule update --init --recursive
- name: Get commits between HEAD and main in the submodule
id: submodule-commits
run: |
cd ./deps/first/Unreal
git fetch origin main
# Get the remote URL to extract owner/repo
REMOTE_URL=$(git config --get remote.origin.url)
# Extract owner/repo from the URL (works for both HTTPS and SSH)
if [[ $REMOTE_URL == [email protected]:* ]]; then
REPO_PATH=${REMOTE_URL#[email protected]:}
REPO_PATH=${REPO_PATH%.git}
else
REPO_PATH=${REMOTE_URL#https://github.com/}
REPO_PATH=${REPO_PATH%.git}
fi
echo "Submodule repository: $REPO_PATH"
# Generate commit list with proper PR links
git log HEAD..main --pretty="tformat:* %s (**%an**) _%h_" | \
sed "s|#\([0-9]\+\)|[#\1](https://github.com/${REPO_PATH}/pull/\1)|g" > submodule-commits.txt
# Read the file content and save to environment variable
{
echo 'COMMITS_BODY<<EOF'
cat submodule-commits.txt
echo EOF
} >> $GITHUB_ENV
- name: Update submodule to latest commit on main branch
run: |
cd ./deps/first/Unreal
git checkout main
git pull origin main
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
commit-message: "chore: update UE submodule"
committer: GitHub <[email protected]>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
title: Update UE Submodule
body: ${{ env.COMMITS_BODY }}
branch: update-ue-submodule
base: main