Cleanup the runtime code sync github action (#19173)

This commit is contained in:
Chris Ross 2020-02-20 16:44:12 -08:00 committed by GitHub
parent b125c76d5f
commit 147be384ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 34 deletions

28
.github/workflows/ReportDiff.ps1 vendored Normal file
View File

@ -0,0 +1,28 @@
# Check the code is in sync
$changed = (select-string "nothing to commit" artifacts\status.txt).count -eq 0
if (-not $changed) { exit }
# Check if tracking issue is open/closed
$Headers = @{ Authorization = 'token {0}' -f $ENV:GITHUB_TOKEN; };
$result = Invoke-RestMethod -Uri $issue
if ($result.state -eq "closed") {
$json = "{ `"state`": `"open`" }"
$result = Invoke-RestMethod -Method PATCH -Headers $Headers -Uri $issue -Body $json
}
# Add a comment
$status = [IO.File]::ReadAllText("artifacts\status.txt")
$diff = [IO.File]::ReadAllText("artifacts\diff.txt")
$body = @"
The shared code is out of sync.
<details>
<summary>The Diff</summary>
``````
$status
$diff
``````
</details>
"@
$json = ConvertTo-Json -InputObject @{ 'body' = $body }
$issue = $issue + '/comments'
$result = Invoke-RestMethod -Method POST -Headers $Headers -Uri $issue -Body $json

View File

@ -17,14 +17,12 @@ jobs:
uses: actions/checkout@v2.0.0
with:
# Test this script using changes in a fork
# repository: 'Tratcher/aspnetcore'
repository: 'dotnet/aspnetcore'
path: aspnetcore
- name: Checkout runtime
uses: actions/checkout@v2.0.0
with:
# Test this script using changes in a fork
# repository: 'Tratcher/runtime'
repository: 'dotnet/runtime'
path: runtime
- name: Copy
@ -32,9 +30,7 @@ jobs:
working-directory: .\runtime\src\libraries\Common\src\System\Net\Http\aspnetcore\
env:
ASPNETCORE_REPO: d:\a\aspnetcore\aspnetcore\aspnetcore\
run: |
dir
CopyToAspNetCore.cmd
run: CopyToAspNetCore.cmd
- name: Diff
shell: cmd
working-directory: .\aspnetcore\
@ -51,34 +47,6 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Check the code is in sync
$changed = (select-string "nothing to commit" artifacts\status.txt).count -eq 0
if (-not $changed) { exit }
# Test this script using an issue in the local forked repo
# $issue = 'https://api.github.com/repos/Tratcher/aspnetcore/issues/1'
$issue = 'https://api.github.com/repos/dotnet/aspnetcore/issues/18943'
# Check if tracking issue is open/closed
$Headers = @{ Authorization = 'token {0}' -f $ENV:GITHUB_TOKEN; };
$result = Invoke-RestMethod -Uri $issue
if ($result.state -eq "closed") {
$json = "{ `"state`": `"open`" }"
$result = Invoke-RestMethod -Method PATCH -Headers $Headers -Uri $issue -Body $json
}
# Add a comment
$status = [IO.File]::ReadAllText("artifacts\status.txt")
$diff = [IO.File]::ReadAllText("artifacts\diff.txt")
$body = @"
The shared code is out of sync.
<details>
<summary>The Diff</summary>
``````
$status
$diff
``````
</details>
"@
$json = ConvertTo-Json -InputObject @{ 'body' = $body }
$issue = $issue + '/comments'
$result = Invoke-RestMethod -Method POST -Headers $Headers -Uri $issue -Body $json
.\aspnetcore\.github\workflows\ReportDiff.ps1