This repository was archived by the owner on Jun 26, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
106 lines (91 loc) · 4.17 KB
/
Copy pathupdate-submodule.yml
File metadata and controls
106 lines (91 loc) · 4.17 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
97
98
99
100
101
102
103
104
105
106
name: Update OrchardCoreContrib.App Submodules
on:
push:
branches: [ "main" ]
jobs:
update-submodules:
name: Build windows-latest
runs-on: windows-latest
steps:
- name: Checkout OrchardCoreContrib.App
uses: actions/checkout@v6
with:
repository: OrchardCoreContrib/OrchardCoreContrib.App
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 submodules
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
committer: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
author: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
title: Update OrchardCoreContrib.Library 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
# - name: Commit and push changes
# env:
# OCC_TOKEN: ${{ secrets.OCC_TOKEN }}
# run: |
# git config user.name "github-actions[bot]"
# git config user.email "github-actions[bot]@users.noreply.github.com"
# git add --all
# git diff --cached --quiet && exit 0
# git commit -m "Update submodules to latest versions"
# git remote set-url origin https://x-access-token:${OCC_TOKEN}@github.com/OrchardCoreContrib/OrchardCoreContrib.App.git
# git push origin HEAD:main