Skip to content

Commit

Permalink
Upgrade the version sweeper workflow (dotnet#36121)
Browse files Browse the repository at this point in the history
* Upgrade the version sweeper workflow

* Update .github/workflows/version-sweep.yml
  • Loading branch information
IEvangelist authored Jul 7, 2023
1 parent 555c0b0 commit b879f86
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
39 changes: 38 additions & 1 deletion .github/workflows/version-sweep.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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"
Expand All @@ -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
1 change: 1 addition & 0 deletions dotnet-versionsweeper.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"actionType": "all",
"outOfSupportWithinDays": 60,
"ignore":[
"samples/**/*.*",
Expand Down

0 comments on commit b879f86

Please sign in to comment.