-
-
Notifications
You must be signed in to change notification settings - Fork 0
96 lines (82 loc) · 3.54 KB
/
Copy pathupdate-submodule.yml
File metadata and controls
96 lines (82 loc) · 3.54 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: Orchard Core Contrib Testing - Update Submodule
on:
push:
branches: [ main ]
paths-ignore:
- 'README.md'
jobs:
update-submodules:
runs-on: windows-latest
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
steps:
- name: Checkout OrchardCoreContrib
uses: actions/checkout@v6
with:
repository: OrchardCoreContrib/OrchardCoreContrib
submodules: true
token: ${{ secrets.OCC_TOKEN }}
- name: Capture Current Submodule Commit Hash
id: submodule-old
shell: pwsh
run: |
$line = (git submodule status --recursive | Select-Object -First 1).Trim()
$parts = $line -split '\s+'
$hash = $parts[0].TrimStart('-','+')
$path = $parts[1]
"hash=$hash" >> $env:GITHUB_OUTPUT
"path=$path" >> $env:GITHUB_OUTPUT
- name: Update submodule
run: |
git submodule sync --recursive
git submodule update --init --recursive
git submodule update --recursive --remote
- name: Capture Updated Submodule Details
id: submodule-new
shell: pwsh
env:
OLD_HASH: ${{ steps.submodule-old.outputs.hash }}
SUBMODULE_PATH: ${{ steps.submodule-old.outputs.path }}
run: |
$line = (git submodule status --recursive | Select-Object -First 1).Trim()
$newHash = ($line -split '\s+')[0].TrimStart('-','+')
$repoUrl = (git -C $env:SUBMODULE_PATH config --get remote.origin.url).Trim()
if ($repoUrl -match '^git@github\.com:(.+)\.git$') {
$repoUrl = "https://github.com/$($Matches[1])"
} else {
$repoUrl = $repoUrl -replace '\.git$',''
}
$repoName = $repoUrl.Split('/')[-1]
$oldShort = $env:OLD_HASH.Substring(0,7)
$newShort = $newHash.Substring(0,7)
"repoUrl=$repoUrl" >> $env:GITHUB_OUTPUT
"repoName=$repoName" >> $env:GITHUB_OUTPUT
"oldHash=$($env:OLD_HASH)" >> $env:GITHUB_OUTPUT
"newHash=$newHash" >> $env:GITHUB_OUTPUT
"oldShort=$oldShort" >> $env:GITHUB_OUTPUT
"newShort=$newShort" >> $env:GITHUB_OUTPUT
"oldCommitUrl=$repoUrl/commit/$($env:OLD_HASH)" >> $env:GITHUB_OUTPUT
"newCommitUrl=$repoUrl/commit/$newHash" >> $env:GITHUB_OUTPUT
"compareUrl=$repoUrl/compare/$($env:OLD_HASH)...$newHash" >> $env:GITHUB_OUTPUT
- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.OCC_TOKEN }}
commit-message: Update submodule to latest version
title: Update OrchardCoreContrib.Testing Submodule Version
body: |
Updated [${{ steps.submodule-new.outputs.repoName }}](${{ steps.submodule-new.outputs.repoUrl }}) from ${{ steps.submodule-new.outputs.oldShort }} to ${{ steps.submodule-new.outputs.newShort }}.
<details>
<summary>Details</summary>
_This automated submodule update was generated by workflow._
- Old commit: [${{ steps.submodule-new.outputs.oldShort }}](${{ steps.submodule-new.outputs.oldCommitUrl }})
- New commit: [${{ steps.submodule-new.outputs.newShort }}](${{ steps.submodule-new.outputs.newCommitUrl }})
[View changes](${{ steps.submodule-new.outputs.compareUrl }})
</details>
branch: update-submodule
delete-branch: true
base: main
labels: |
dependencies
submodule