From ccdbf112e4f71eef7ebbb9ca43121673ad4d9eeb Mon Sep 17 00:00:00 2001 From: Guilherme Branco Stracini Date: Sun, 5 Nov 2023 00:42:27 +0000 Subject: [PATCH] Update update-packages.yml (#72) --- .github/workflows/update-packages.yml | 58 +++++++++++++++------------ 1 file changed, 33 insertions(+), 25 deletions(-) diff --git a/.github/workflows/update-packages.yml b/.github/workflows/update-packages.yml index e83421e..ac360d8 100644 --- a/.github/workflows/update-packages.yml +++ b/.github/workflows/update-packages.yml @@ -1,20 +1,22 @@ name: Update packages -on: +on: workflow_dispatch: schedule: - cron: "0 2 * * 0" -concurrency: +concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true -jobs: +jobs: update_packages: name: Update packages - runs-on: windows-latest - + runs-on: self-hosted + outputs: + branchExists: ${{ steps.verify-changed-files.outputs.files_changed }} + steps: - name: Generate a token id: generate_token @@ -22,55 +24,61 @@ jobs: with: app_id: ${{ secrets.APP_ID }} private_key: ${{ secrets.APP_PRIVATE_KEY }} - + - name: Checkout code uses: actions/checkout@v4 with: fetch-depth: 0 token: ${{ steps.generate_token.outputs.token }} - + - name: Set solution name run: | echo "solution=$(([io.fileinfo]$(Get-ChildItem -Path .\* -Include *.sln)).name)" | Out-File -FilePath $env:GITHUB_ENV -Append - + - name: Add MSBuild to PATH uses: microsoft/setup-msbuild@v1.3 env: ACTIONS_ALLOW_UNSECURE_COMMANDS: true - + - name: Setup Nuget - uses: nuget/setup-nuget@v1 + uses: nuget/setup-nuget@v1 env: - ACTIONS_ALLOW_UNSECURE_COMMANDS: true - - - name: Create new branch + ACTIONS_ALLOW_UNSECURE_COMMANDS: true + + - name: Create new branch run: git branch features/update_dependencies_${{ github.run_number }} - + - name: Switch branch - run: git checkout features/update_dependencies_${{ github.run_number }} - + run: git checkout features/update_dependencies_${{ github.run_number }} + - name: NuGet restore run: nuget restore - + - name: Update NuGet packages run: nuget update "${{ env.solution }}" -FileConflictAction Ignore - name: Setup GIT config run: | - git config user.name "dotNETFrameworkUpdater" - git config user.email "<>" + git config user.name "net-framework-updater[bot]" + git config user.email "136581072+net-framework-updater[bot]@users.noreply.github.com" git config --global --add --bool push.autoSetupRemote true - + + - name: Verify Changed files + uses: tj-actions/verify-changed-files@v16 + id: verify-changed-files + - name: Commit and Push + if: steps.verify-changed-files.outputs.files_changed == 'true' run: | git add . git commit -a -m "Packages update (CI)" git push - + create_pull_request: name: Create pull request runs-on: ubuntu-latest needs: update_packages + if: needs.update_packages.outputs.branchExists == 'true' steps: - name: Generate a token @@ -79,23 +87,23 @@ jobs: with: app_id: ${{ secrets.APP_ID }} private_key: ${{ secrets.APP_PRIVATE_KEY }} - + - name: Checkout code uses: actions/checkout@v4 with: fetch-depth: 0 token: ${{ steps.generate_token.outputs.token }} ref: features/update_dependencies_${{ github.run_number }} - + - name: Create pull request uses: devops-infra/action-pull-request@v0.5.5 with: github_token: ${{ steps.generate_token.outputs.token }} - source_branch: features/update_dependencies_${{ github.run_number }} + source_branch: feature/update_dependencies_${{ github.run_number }} target_branch: main title: Update NuGet packages assignee: guibranco reviewer: guibranco - label: dependencies,.NET,infra,NuGet,packages + label: dependencies,.NET,infra,nuget,packages template: .github/PULL_REQUEST_TEMPLATE/FEATURE.md get_diff: true