Skip to content

Commit

Permalink
Merge pull request #306 from AArnott/libtemplateWorkflowUpdates
Browse files Browse the repository at this point in the history
Self-updating workflow updates
  • Loading branch information
AArnott authored Nov 12, 2024
2 parents d76ba4a + 0459d74 commit 2be8070
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/libtemplate-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,16 @@ on:
jobs:
merge:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.

- name: merge
id: merge
shell: pwsh
run: |
$LibTemplateBranch = & ./azure-pipelines/Get-LibTemplateBasis.ps1 -ErrorIfNotRelated
Expand All @@ -31,15 +35,18 @@ jobs:
exit $LASTEXITCODE
}
$LibTemplateCommit = git rev-parse FETCH_HEAD
git diff --stat ...FETCH_HEAD
if ((git rev-list FETCH_HEAD ^HEAD --count) -eq 0) {
Write-Host "There are no Library.Template updates to merge."
echo "::set-output name=uptodate::true"
exit 0
}
git -c http.extraheader="AUTHORIZATION: bearer $env:GH_TOKEN" push origin -u FETCH_HEAD:refs/heads/auto/libtemplateUpdate
- name: pull request
shell: pwsh
if: success() && steps.merge.outputs.uptodate != 'true'
run: |
# If there is already an active pull request, don't create a new one.
$existingPR = gh pr list -H auto/libtemplateUpdate --json url | ConvertFrom-Json
Expand Down

0 comments on commit 2be8070

Please sign in to comment.