-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
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 2ade36d
Call CopyToAspNetCore.cmd
Tratcher 5643782
Fix spacing
Tratcher 338fff0
Exit code?
Tratcher cd123f5
Override error
Tratcher f78f2eb
More error codes
Tratcher a9c26c1
My Fork of runtime with patched script
Tratcher 8f96226
Remove old comment
Tratcher 94c7a3b
Upload artifacts
Tratcher 8556cd6
Add path
Tratcher 6340323
file names?
Tratcher 6978555
Combine artifacts
Tratcher 10ca390
Make artifacts dir
Tratcher 2c90746
Pass/Fail
Tratcher 2e2830d
continue-on-error
Tratcher fbdf5d5
React to dir restructure
Tratcher 293c36a
Fix status path
Tratcher 6ab99aa
Triggering a run
Tratcher e4bec4b
Powershell!
Tratcher c7ee4da
bools
Tratcher 0e93d2a
typo
Tratcher ae96291
artifacts path
Tratcher de60064
wrong typo
Tratcher a0ced12
simplified auth
Tratcher 441088f
Test issue in my own repo
Tratcher 710db6d
Post a comment
Tratcher cda4528
Include content
Tratcher 6f5c77f
Fix artifacts path
Tratcher e7dd879
Formatting
Tratcher 651309f
Formatting
Tratcher e3fa3da
Test schedule, add test comments
Tratcher 426cc0f
Clarify time zone
Tratcher a058c29
Disable test settings
Tratcher 7d80e45
Update CODEOWNERS for shared runtime src
Tratcher 402fa5c
Add ReportDiff.ps1
Tratcher 16b0bca
ps1
Tratcher 96107b2
Explore dir structure, move ps1
Tratcher cd8c7c1
Path fixup
Tratcher 10aaf78
Revert path changes
Tratcher b7feaec
Path fixups
Tratcher bb005f1
Troubleshoot script path
Tratcher 0ca6f13
Test local repo
Tratcher a9e25e8
Remove test fields
Tratcher 5fa780d
Merge branch 'master' into master
Tratcher File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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\ | ||
|
@@ -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 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.