Automatically send a PR for runtime changes (#19305)
This commit is contained in:
parent
2849549dbc
commit
87037b84e0
|
|
@ -1,6 +1,6 @@
|
|||
# Check the code is in sync
|
||||
$changed = (select-string "nothing to commit" artifacts\status.txt).count -eq 0
|
||||
if (-not $changed) { exit }
|
||||
if (-not $changed) { return $changed }
|
||||
# Check if tracking issue is open/closed
|
||||
$Headers = @{ Authorization = 'token {0}' -f $ENV:GITHUB_TOKEN; };
|
||||
$result = Invoke-RestMethod -Uri $issue
|
||||
|
|
@ -26,3 +26,4 @@ $diff
|
|||
$json = ConvertTo-Json -InputObject @{ 'body' = $body }
|
||||
$issue = $issue + '/comments'
|
||||
$result = Invoke-RestMethod -Method POST -Headers $Headers -Uri $issue -Body $json
|
||||
return $changed
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
name: AspNetCore-Runtime Code Sync
|
||||
on:
|
||||
# Test this script using on: push
|
||||
# push
|
||||
# push:
|
||||
schedule:
|
||||
# * is a special character in YAML so you have to quote this string
|
||||
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/events-that-trigger-workflows#scheduled-events-schedule
|
||||
|
|
@ -43,10 +43,25 @@ jobs:
|
|||
name: results
|
||||
path: artifacts
|
||||
- name: Check and Notify
|
||||
id: check
|
||||
shell: pwsh
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
# Test this script using an issue in the local forked repo
|
||||
$issue = 'https://api.github.com/repos/dotnet/aspnetcore/issues/18943'
|
||||
.\aspnetcore\.github\workflows\ReportDiff.ps1
|
||||
$changed = .\aspnetcore\.github\workflows\ReportDiff.ps1
|
||||
echo "::set-output name=changed::$changed"
|
||||
- name: Send PR
|
||||
if: steps.check.outputs.changed == 'true'
|
||||
# https://github.com/marketplace/actions/create-pull-request
|
||||
uses: peter-evans/create-pull-request@v2
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
path: .\aspnetcore
|
||||
commit-message: 'Sync shared code from runtime'
|
||||
title: 'Sync shared code from runtime'
|
||||
body: 'This PR was automatically generated to sync shared code changes from runtime. Fixes #18943'
|
||||
labels: area-servers
|
||||
branch: github-action/sync-runtime
|
||||
branch-suffix: timestamp
|
||||
|
|
|
|||
Loading…
Reference in New Issue