Skip to content
This repository was archived by the owner on Jun 26, 2026. It is now read-only.

Commit 6ebe907

Browse files
committed
Update PR info
1 parent 3fd840b commit 6ebe907

1 file changed

Lines changed: 41 additions & 10 deletions

File tree

.github/workflows/update-submodule.yml

Lines changed: 41 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,33 +17,64 @@ jobs:
1717
submodules: true
1818
token: ${{ secrets.OCC_TOKEN }}
1919

20+
- name: Capture current submodule commit hash
21+
id: submodule-old
22+
shell: pwsh
23+
run: |
24+
$line = (git submodule status --recursive | Select-Object -First 1).Trim()
25+
$parts = $line -split '\s+'
26+
$hash = $parts[0].TrimStart('-','+')
27+
$path = $parts[1]
28+
"hash=$hash" >> $env:GITHUB_OUTPUT
29+
"path=$path" >> $env:GITHUB_OUTPUT
30+
2031
- name: Update submodules
2132
run: |
2233
git submodule sync --recursive
2334
git submodule update --init --recursive
2435
git submodule update --recursive --remote
2536
26-
- name: Get updated submodule commit hash
27-
id: submodule-hash
37+
- name: Capture updated submodule details
38+
id: submodule-new
2839
shell: pwsh
40+
env:
41+
OLD_HASH: ${{ steps.submodule-old.outputs.hash }}
42+
SUBMODULE_PATH: ${{ steps.submodule-old.outputs.path }}
2943
run: |
3044
$line = (git submodule status --recursive | Select-Object -First 1).Trim()
31-
$hash = ($line -split '\s+')[0].TrimStart('-','+')
32-
$shortHash = $hash.Substring(0,7)
33-
$commitUrl = "https://github.com/OrchardCoreContrib/OrchardCoreContrib.Library/commit/$hash"
34-
"shortHash=$shortHash" >> $env:GITHUB_OUTPUT
35-
"url=$commitUrl" >> $env:GITHUB_OUTPUT
45+
$newHash = ($line -split '\s+')[0].TrimStart('-','+')
46+
47+
$repoUrl = (git -C $env:SUBMODULE_PATH config --get remote.origin.url).Trim()
48+
if ($repoUrl -match '^git@github\.com:(.+)\.git$') {
49+
$repoUrl = "https://github.com/$($Matches[1])"
50+
} else {
51+
$repoUrl = $repoUrl -replace '\.git$',''
52+
}
53+
54+
$repoName = $repoUrl.Split('/')[-1]
55+
$oldShort = $env:OLD_HASH.Substring(0,7)
56+
$newShort = $newHash.Substring(0,7)
57+
58+
"repoUrl=$repoUrl" >> $env:GITHUB_OUTPUT
59+
"repoName=$repoName" >> $env:GITHUB_OUTPUT
60+
"oldHash=$($env:OLD_HASH)" >> $env:GITHUB_OUTPUT
61+
"newHash=$newHash" >> $env:GITHUB_OUTPUT
62+
"oldShort=$oldShort" >> $env:GITHUB_OUTPUT
63+
"newShort=$newShort" >> $env:GITHUB_OUTPUT
64+
"oldCommitUrl=$repoUrl/commit/$($env:OLD_HASH)" >> $env:GITHUB_OUTPUT
65+
"newCommitUrl=$repoUrl/commit/$newHash" >> $env:GITHUB_OUTPUT
66+
"compareUrl=$repoUrl/compare/$($env:OLD_HASH)...$newHash" >> $env:GITHUB_OUTPUT
3667
3768
- name: Create Pull Request
3869
uses: peter-evans/create-pull-request@v7
3970
with:
4071
token: ${{ secrets.OCC_TOKEN }}
4172
commit-message: Update submodule to latest version
42-
title: Update OrchardCoreContrib.Library submodule to latest version
73+
title: Update OrchardCoreContrib.Library Submodule
4374
body: |
44-
Automated submodule update generated by workflow.
75+
Updated [${{ steps.submodule-new.outputs.repoName }}](${{ steps.submodule-new.outputs.repoUrl }}) from `${{ steps.submodule-new.outputs.oldShort }}` to `${{ steps.submodule-new.outputs.newShort }}`..
4576
46-
Commit: [`${{ steps.submodule-hash.outputs.shortHash }}`](${{ steps.submodule-hash.outputs.url }})
77+
[View changes](${{ steps.submodule-new.outputs.compareUrl }})
4778
branch: update-submodules
4879
delete-branch: true
4980
base: main

0 commit comments

Comments
 (0)