Skip to content

Cleanup the runtime code sync github action #19173

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 44 commits into from
Feb 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
48f02fb
Create runtime code sync action
Tratcher Feb 6, 2020
2ade36d
Call CopyToAspNetCore.cmd
Tratcher Feb 7, 2020
5643782
Fix spacing
Tratcher Feb 7, 2020
338fff0
Exit code?
Tratcher Feb 7, 2020
cd123f5
Override error
Tratcher Feb 7, 2020
f78f2eb
More error codes
Tratcher Feb 7, 2020
a9c26c1
My Fork of runtime with patched script
Tratcher Feb 7, 2020
8f96226
Remove old comment
Tratcher Feb 7, 2020
94c7a3b
Upload artifacts
Tratcher Feb 10, 2020
8556cd6
Add path
Tratcher Feb 10, 2020
6340323
file names?
Tratcher Feb 10, 2020
6978555
Combine artifacts
Tratcher Feb 10, 2020
10ca390
Make artifacts dir
Tratcher Feb 10, 2020
2c90746
Pass/Fail
Tratcher Feb 11, 2020
2e2830d
continue-on-error
Tratcher Feb 11, 2020
fbdf5d5
React to dir restructure
Tratcher Feb 12, 2020
293c36a
Fix status path
Tratcher Feb 12, 2020
6ab99aa
Triggering a run
Tratcher Feb 12, 2020
e4bec4b
Powershell!
Tratcher Feb 12, 2020
c7ee4da
bools
Tratcher Feb 12, 2020
0e93d2a
typo
Tratcher Feb 12, 2020
ae96291
artifacts path
Tratcher Feb 12, 2020
de60064
wrong typo
Tratcher Feb 12, 2020
a0ced12
simplified auth
Tratcher Feb 12, 2020
441088f
Test issue in my own repo
Tratcher Feb 12, 2020
710db6d
Post a comment
Tratcher Feb 12, 2020
cda4528
Include content
Tratcher Feb 13, 2020
6f5c77f
Fix artifacts path
Tratcher Feb 13, 2020
e7dd879
Formatting
Tratcher Feb 13, 2020
651309f
Formatting
Tratcher Feb 13, 2020
e3fa3da
Test schedule, add test comments
Tratcher Feb 13, 2020
426cc0f
Clarify time zone
Tratcher Feb 13, 2020
a058c29
Disable test settings
Tratcher Feb 13, 2020
7d80e45
Update CODEOWNERS for shared runtime src
Tratcher Feb 13, 2020
402fa5c
Add ReportDiff.ps1
Tratcher Feb 19, 2020
16b0bca
ps1
Tratcher Feb 19, 2020
96107b2
Explore dir structure, move ps1
Tratcher Feb 19, 2020
cd8c7c1
Path fixup
Tratcher Feb 19, 2020
10aaf78
Revert path changes
Tratcher Feb 19, 2020
b7feaec
Path fixups
Tratcher Feb 19, 2020
bb005f1
Troubleshoot script path
Tratcher Feb 19, 2020
0ca6f13
Test local repo
Tratcher Feb 20, 2020
a9e25e8
Remove test fields
Tratcher Feb 20, 2020
5fa780d
Merge branch 'master' into master
Tratcher Feb 20, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/ReportDiff.ps1
Original file line number Diff line number Diff line change
@@ -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
36 changes: 2 additions & 34 deletions .github/workflows/runtime-sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,20 @@ jobs:
uses: actions/[email protected]
with:
# Test this script using changes in a fork
# repository: 'Tratcher/aspnetcore'
repository: 'dotnet/aspnetcore'
path: aspnetcore
- name: Checkout runtime
uses: actions/[email protected]
with:
# Test this script using changes in a fork
# repository: 'Tratcher/runtime'
repository: 'dotnet/runtime'
path: runtime
- name: Copy
shell: cmd
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\
Expand All @@ -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'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the $issue var is in scope of the ReportDiff.ps1 invocation? TIL.

# 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