Skip to content

Commit 119f009

Browse files
authored
Merge pull request #268 from microsoft/dev/andarno/libtemplateUpdate
Merge latest Library.Template
2 parents e6cf7c9 + c367ec7 commit 119f009

File tree

2 files changed

+73
-1
lines changed

2 files changed

+73
-1
lines changed

.config/dotnet-tools.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"isRoot": true,
44
"tools": {
55
"powershell": {
6-
"version": "7.4.5",
6+
"version": "7.4.6",
77
"commands": [
88
"pwsh"
99
]
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Library.Template update
2+
3+
# PREREQUISITE: This workflow requires the repo to be configured to allow workflows to push commits and create pull requests.
4+
# Visit https://github.com/USER/REPO/settings/actions
5+
# Under "Workflow permissions", select "Read and write permissions" and check "Allow GitHub Actions to create ...pull requests"
6+
# Click Save.
7+
8+
on:
9+
schedule:
10+
- cron: "0 3 * * Mon" # Sun @ 8 or 9 PM Mountain Time (depending on DST)
11+
workflow_dispatch:
12+
13+
jobs:
14+
merge:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
20+
21+
- name: merge
22+
shell: pwsh
23+
run: |
24+
$LibTemplateBranch = & ./azure-pipelines/Get-LibTemplateBasis.ps1 -ErrorIfNotRelated
25+
if ($LASTEXITCODE -ne 0) {
26+
exit $LASTEXITCODE
27+
}
28+
29+
git fetch https://github.com/aarnott/Library.Template $LibTemplateBranch
30+
if ($LASTEXITCODE -ne 0) {
31+
exit $LASTEXITCODE
32+
}
33+
$LibTemplateCommit = git rev-parse FETCH_HEAD
34+
35+
if ((git rev-list FETCH_HEAD ^HEAD --count) -eq 0) {
36+
Write-Host "There are no Library.Template updates to merge."
37+
exit 0
38+
}
39+
40+
git -c http.extraheader="AUTHORIZATION: bearer $env:GH_TOKEN" push origin -u FETCH_HEAD:refs/heads/auto/libtemplateUpdate
41+
- name: pull request
42+
shell: pwsh
43+
run: |
44+
# If there is already an active pull request, don't create a new one.
45+
$existingPR = gh pr list -H auto/libtemplateUpdate --json url | ConvertFrom-Json
46+
if ($existingPR) {
47+
Write-Host "::warning::Skipping pull request creation because one already exists at $($existingPR[0].url)"
48+
exit 0
49+
}
50+
51+
$prTitle = "Merge latest Library.Template"
52+
$prBody = "This merges the latest features and fixes from [Library.Template's branch](https://github.com/AArnott/Library.Template/tree/).
53+
54+
<details>
55+
<summary>Merge conflicts?</summary>
56+
Resolve merge conflicts locally by carrying out these steps:
57+
58+
```
59+
git fetch
60+
git checkout auto/libtemplateUpdate
61+
git merge origin/main
62+
# resolve conflicts
63+
git commit
64+
git push
65+
```
66+
</details>
67+
68+
⚠️ Do **not** squash this pull request when completing it. You must *merge* it."
69+
70+
gh pr create -H auto/libtemplateUpdate -b $prBody -t $prTitle
71+
env:
72+
GH_TOKEN: ${{ github.token }}

0 commit comments

Comments
 (0)