runtime-sync.yml 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. jobs:
  11. compare_repos:
  12. # Comment out this line to test the scripts in a fork
  13. if: github.repository == 'dotnet/aspnetcore'
  14. name: Compare the shared code in the AspNetCore and Runtime repos and notify if they're out of sync.
  15. runs-on: windows-latest
  16. steps:
  17. - name: Checkout aspnetcore
  18. uses: actions/[email protected]
  19. with:
  20. # Test this script using changes in a fork
  21. repository: 'dotnet/aspnetcore'
  22. path: aspnetcore
  23. ref: main
  24. - name: Checkout runtime
  25. uses: actions/[email protected]
  26. with:
  27. # Test this script using changes in a fork
  28. repository: 'dotnet/runtime'
  29. path: runtime
  30. ref: main
  31. - name: Copy
  32. shell: cmd
  33. working-directory: .\runtime\src\libraries\Common\src\System\Net\Http\aspnetcore\
  34. env:
  35. ASPNETCORE_REPO: d:\a\aspnetcore\aspnetcore\aspnetcore\
  36. run: CopyToAspNetCore.cmd
  37. - name: Diff
  38. shell: cmd
  39. working-directory: .\aspnetcore\
  40. run: |
  41. mkdir ..\artifacts
  42. git status > ..\artifacts\status.txt
  43. git diff > ..\artifacts\diff.txt
  44. - uses: actions/upload-artifact@v1
  45. with:
  46. name: results
  47. path: artifacts
  48. - name: Check and Notify
  49. id: check
  50. shell: pwsh
  51. env:
  52. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  53. run: |
  54. # Test this script using an issue in the local forked repo
  55. $issue = 'https://api.github.com/repos/dotnet/aspnetcore/issues/18943'
  56. $changed = .\aspnetcore\.github\workflows\ReportDiff.ps1
  57. echo "::set-output name=changed::$changed"
  58. - name: Send PR
  59. if: steps.check.outputs.changed == 'true'
  60. # https://github.com/marketplace/actions/create-pull-request
  61. uses: dotnet/actions-create-pull-request@v3
  62. with:
  63. token: ${{ secrets.GITHUB_TOKEN }}
  64. path: .\aspnetcore
  65. commit-message: 'Sync shared code from runtime'
  66. title: 'Sync shared code from runtime'
  67. body: 'This PR was automatically generated to sync shared code changes from runtime. Fixes #18943'
  68. labels: area-runtime
  69. base: main
  70. branch: github-action/sync-runtime
  71. branch-suffix: timestamp