runtime-sync.yml 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. name: AspNetCore-Runtime Code Sync
  2. on:
  3. # Manual run
  4. workflow_dispatch:
  5. schedule:
  6. # * is a special character in YAML so you have to quote this string
  7. # https://help.github.com/en/actions/automating-your-workflow-with-github-actions/events-that-trigger-workflows#scheduled-events-schedule
  8. # Once per day at midnight PST (8 UTC)
  9. - cron: '0 8 * * *'
  10. permissions:
  11. contents: write
  12. issues: write
  13. pull-requests: write
  14. jobs:
  15. compare_repos:
  16. # Comment out this line to test the scripts in a fork
  17. if: github.repository == 'dotnet/aspnetcore'
  18. name: Compare the shared code in the AspNetCore and Runtime repos and notify if they're out of sync.
  19. runs-on: windows-latest
  20. steps:
  21. - name: Checkout aspnetcore
  22. uses: actions/checkout@v3
  23. with:
  24. # Test this script using changes in a fork
  25. repository: 'dotnet/aspnetcore'
  26. path: aspnetcore
  27. ref: main
  28. - name: Checkout runtime
  29. uses: actions/checkout@v3
  30. with:
  31. # Test this script using changes in a fork
  32. repository: 'dotnet/runtime'
  33. path: runtime
  34. ref: main
  35. - name: Copy
  36. shell: cmd
  37. working-directory: .\runtime\src\libraries\Common\src\System\Net\Http\aspnetcore\
  38. env:
  39. ASPNETCORE_REPO: d:\a\aspnetcore\aspnetcore\aspnetcore\
  40. run: CopyToAspNetCore.cmd
  41. - name: Diff
  42. shell: cmd
  43. working-directory: .\aspnetcore\
  44. run: |
  45. mkdir ..\artifacts
  46. git status > ..\artifacts\status.txt
  47. git diff > ..\artifacts\diff.txt
  48. - uses: actions/upload-artifact@v3
  49. with:
  50. name: results
  51. path: artifacts
  52. - name: Check and Notify
  53. id: check
  54. shell: pwsh
  55. env:
  56. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  57. run: |
  58. # Test this script using an issue in the local forked repo
  59. $issue = 'https://api.github.com/repos/dotnet/aspnetcore/issues/18943'
  60. $sendpr = .\aspnetcore\.github\workflows\ReportDiff.ps1
  61. echo "sendpr=$sendpr" >> $env:GITHUB_OUTPUT
  62. - name: Send PR
  63. if: steps.check.outputs.sendpr == 'true'
  64. # https://github.com/marketplace/actions/create-pull-request
  65. uses: dotnet/actions-create-pull-request@v4
  66. with:
  67. token: ${{ secrets.GITHUB_TOKEN }}
  68. path: .\aspnetcore
  69. commit-message: 'Sync shared code from runtime'
  70. title: 'Sync shared code from runtime'
  71. body: 'This PR was automatically generated to sync shared code changes from runtime. Fixes #18943'
  72. labels: area-runtime
  73. base: main
  74. branch: github-action/sync-runtime
  75. branch-suffix: timestamp