From b879f86cf1806f890e6d4fe4bc0297385be289b5 Mon Sep 17 00:00:00 2001 From: David Pine Date: Fri, 7 Jul 2023 08:54:00 -0500 Subject: [PATCH] Upgrade the version sweeper workflow (#36121) * Upgrade the version sweeper workflow * Update .github/workflows/version-sweep.yml --- .github/workflows/version-sweep.yml | 39 ++++++++++++++++++++++++++++- dotnet-versionsweeper.json | 1 + 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/.github/workflows/version-sweep.yml b/.github/workflows/version-sweep.yml index b843d3551b711..7aec67dde084c 100644 --- a/.github/workflows/version-sweep.yml +++ b/.github/workflows/version-sweep.yml @@ -13,6 +13,10 @@ on: description: "The reason for running the workflow" required: true default: "Manual run" + support: + description: "The support level to target (STS, LTS, or Preview)." + required: true + default: "STS" # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: @@ -27,7 +31,7 @@ jobs: # Steps represent a sequence of tasks that will be executed as part of the job steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # Runs a single command using the runners shell - name: "Print manual run reason" @@ -45,3 +49,36 @@ jobs: owner: ${{ github.repository_owner }} name: ${{ github.repository }} branch: ${{ github.ref }} + + - name: Create pull requests + if: steps.dotnet-version-sweeper.outputs.has-remaining-work == 'true' + run: | + upgradeProjects: ${{ steps.dotnet-version-sweeper.outputs.upgradeProjects }} + + # Install .NET Upgrade Assistant global tool + dotnet tool install --global upgrade-assistant + + # Iterate all upgrade projects + for projectDir in "${upgradeProjects[@]}"; do + echo "Project Directory: $projectDir" + + # Create a new branch + git checkout -b upgrade/$projectDir + + # Perform the upgrade using upgrade-assistant + upgrade-assistant upgrade "$projectDir" --non-interactive -t ${{ inputs.support }} + + # Commit the changes + git add . + git commit -m ".NET Version Sweeper: Upgraded $projectDir" + + # Push the branch to the repository + git push origin upgrade/$projectDir + + # Create a pull request + gh pr create \ + --base main \ + --head upgrade/$projectDir \ + --title "Upgraded $projectDir" \ + --body "Proposed upgrade for $projectDir" + done diff --git a/dotnet-versionsweeper.json b/dotnet-versionsweeper.json index c6759e15ad9ee..9cb3e4f9d5f9c 100644 --- a/dotnet-versionsweeper.json +++ b/dotnet-versionsweeper.json @@ -1,4 +1,5 @@ { + "actionType": "all", "outOfSupportWithinDays": 60, "ignore":[ "samples/**/*.*",