From c9175bac4eb8b1d89a4cae0155de1a25381044e2 Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Mon, 14 Nov 2022 11:15:41 +0100 Subject: [PATCH 1/5] chore: replace deprecated GH set-output --- .github/workflows/updater.yml | 12 ++++++------ updater/scripts/update-dependency.ps1 | 10 +++++----- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/updater.yml b/.github/workflows/updater.yml index 4dc0202..1b80249 100644 --- a/.github/workflows/updater.yml +++ b/.github/workflows/updater.yml @@ -129,14 +129,14 @@ jobs: run: | $mainBranch = $(git remote show origin | Select-String "HEAD branch: (.*)").Matches[0].Groups[1].Value Write-Host '::echo::on' - Write-Host "::set-output name=baseBranch::$mainBranch" + "baseBranch=$mainBranch" >> $env:GITHUB_OUTPUT $prBranch = switch ('${{ inputs.pr-strategy }}') { 'create' { 'deps/${{ inputs.path }}/${{ steps.target.outputs.latestTag }}' } 'update' { 'deps/${{ inputs.path }}' } default { throw "Unkown PR strategy '${{ inputs.pr-strategy }}'." } } - Write-Host "::set-output name=prBranch::$prBranch" + "prBranch=$prBranch" >> $env:GITHUB_OUTPUT - name: Fetch an existing PR if: steps.target.outputs.latestTag != steps.target.outputs.originalTag @@ -162,12 +162,12 @@ jobs: Write-Host '::echo::on' if ($prCount -eq '0') { - Write-Host "::set-output name=url::" + "url=" >> $env:GITHUB_OUTPUT } elseif ($prCount -eq '1') { $url = $($data | Select-String '"html_url": +"(.*/pull/.*)"').Matches[0].Groups[1].Value - Write-Host "::set-output name=url::$url" + "url=$url" >> $env:GITHUB_OUTPUT } else { @@ -212,11 +212,11 @@ jobs: Write-Host '::echo::on' if ('${{ steps.create-pr.outputs.pull-request-url }}' -ne '') { - Write-Host "::set-output name=url::${{ steps.create-pr.outputs.pull-request-url }}" + "url=${{ steps.create-pr.outputs.pull-request-url }}" >> $env:GITHUB_OUTPUT } elseif ('${{ steps.existing-pr.outputs.url }}' -ne '') { - Write-Host "::set-output name=url::${{ steps.existing-pr.outputs.url }}" + "url=${{ steps.existing-pr.outputs.url }}" >> $env:GITHUB_OUTPUT } else { diff --git a/updater/scripts/update-dependency.ps1 b/updater/scripts/update-dependency.ps1 index 36226e0..ff2f2c1 100644 --- a/updater/scripts/update-dependency.ps1 +++ b/updater/scripts/update-dependency.ps1 @@ -134,11 +134,11 @@ if ("$Tag" -eq "") $latestTagNice = ($latestTag -match "^[0-9]") ? "v$latestTag" : $latestTag Write-Host '::echo::on' - Write-Host "::set-output name=originalTag::$originalTag" - Write-Host "::set-output name=latestTag::$latestTag" - Write-Host "::set-output name=latestTagNice::$latestTagNice" - Write-Host "::set-output name=url::$url" - Write-Host "::set-output name=mainBranch::$mainBranch" + "originalTag=$originalTag" >> $env:GITHUB_OUTPUT + "latestTag=$latestTag" >> $env:GITHUB_OUTPUT + "latestTagNice=$latestTagNice" >> $env:GITHUB_OUTPUT + "url=$url" >> $env:GITHUB_OUTPUT + "mainBranch=$mainBranch" >> $env:GITHUB_OUTPUT if ("$originalTag" -eq "$latestTag") { From 651913a353ac48fe7d37c4d9ca79f2921390c9b3 Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Mon, 14 Nov 2022 11:48:24 +0100 Subject: [PATCH 2/5] chore: update peter-evans/create-pull-request action --- .github/workflows/updater.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/updater.yml b/.github/workflows/updater.yml index 1b80249..7442bec 100644 --- a/.github/workflows/updater.yml +++ b/.github/workflows/updater.yml @@ -189,7 +189,7 @@ jobs: # First we create a PR only if it doesn't exist. We will later overwrite the content with the same action. - name: Create a PR if: ${{ ( steps.target.outputs.latestTag != steps.target.outputs.originalTag ) && ( steps.existing-pr.outputs.url == '') }} - uses: peter-evans/create-pull-request@f22a7da129c901513876a2380e2dae9f8e145330 + uses: peter-evans/create-pull-request@b4d51739f96fca8047ad065eccef63442d8e99f7 # pin#v4 id: create-pr with: base: ${{ steps.root.outputs.baseBranch }} @@ -253,7 +253,7 @@ jobs: # Now make the PR in its final state. This way we only have one commit and no updates if there are no changes between runs. - name: Update the PR if: steps.target.outputs.latestTag != steps.target.outputs.originalTag - uses: peter-evans/create-pull-request@f22a7da129c901513876a2380e2dae9f8e145330 + uses: peter-evans/create-pull-request@b4d51739f96fca8047ad065eccef63442d8e99f7 with: base: ${{ steps.root.outputs.baseBranch }} branch: ${{ steps.root.outputs.prBranch }} From dd3f82d8a80604e0e83b251f6d8c1b6da3917024 Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Mon, 14 Nov 2022 11:51:05 +0100 Subject: [PATCH 3/5] chore: update styfle/cancel-workflow-action --- .github/workflows/updater.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/updater.yml b/.github/workflows/updater.yml index 7442bec..908d5d7 100644 --- a/.github/workflows/updater.yml +++ b/.github/workflows/updater.yml @@ -68,7 +68,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@a40b8845c0683271d9f53dfcb887a7e181d3918b # Tag: 0.9.1 + uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5 # Tag: 0.11.0 with: access_token: ${{ github.token }} From eabb7c00fb761d41c4425b08570f9148275b8daa Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Mon, 14 Nov 2022 11:56:02 +0100 Subject: [PATCH 4/5] chore: update octokit/request-action --- .github/workflows/updater.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/updater.yml b/.github/workflows/updater.yml index 908d5d7..d9f4d02 100644 --- a/.github/workflows/updater.yml +++ b/.github/workflows/updater.yml @@ -140,7 +140,7 @@ jobs: - name: Fetch an existing PR if: steps.target.outputs.latestTag != steps.target.outputs.originalTag - uses: octokit/request-action@971ad48f9c40ed001c41c2671b1e6e8e8165d5af + uses: octokit/request-action@89a1754fe82ca777b044ca8e79e9881a42f15a93 # v2.1.7 id: existing-pr-request with: route: GET /repos/${{ github.repository }}/pulls?base={base}&head={head} From fa3bf65577a681e89ab90b0d3ffdad26bf1afdb3 Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Mon, 14 Nov 2022 12:04:24 +0100 Subject: [PATCH 5/5] chore: use pwsh tee-object to print output as well as set it to GH --- .github/workflows/updater.yml | 15 ++++++--------- updater/scripts/update-dependency.ps1 | 11 +++++------ 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/.github/workflows/updater.yml b/.github/workflows/updater.yml index d9f4d02..03b5202 100644 --- a/.github/workflows/updater.yml +++ b/.github/workflows/updater.yml @@ -128,15 +128,14 @@ jobs: id: root run: | $mainBranch = $(git remote show origin | Select-String "HEAD branch: (.*)").Matches[0].Groups[1].Value - Write-Host '::echo::on' - "baseBranch=$mainBranch" >> $env:GITHUB_OUTPUT $prBranch = switch ('${{ inputs.pr-strategy }}') { 'create' { 'deps/${{ inputs.path }}/${{ steps.target.outputs.latestTag }}' } 'update' { 'deps/${{ inputs.path }}' } default { throw "Unkown PR strategy '${{ inputs.pr-strategy }}'." } } - "prBranch=$prBranch" >> $env:GITHUB_OUTPUT + "baseBranch=$mainBranch" | Tee-Object $env:GITHUB_OUTPUT -Append + "prBranch=$prBranch" | Tee-Object $env:GITHUB_OUTPUT -Append - name: Fetch an existing PR if: steps.target.outputs.latestTag != steps.target.outputs.originalTag @@ -159,15 +158,14 @@ jobs: $prCount = $($data | jq '. | length') - Write-Host '::echo::on' if ($prCount -eq '0') { - "url=" >> $env:GITHUB_OUTPUT + "url=" | Tee-Object $env:GITHUB_OUTPUT -Append } elseif ($prCount -eq '1') { $url = $($data | Select-String '"html_url": +"(.*/pull/.*)"').Matches[0].Groups[1].Value - "url=$url" >> $env:GITHUB_OUTPUT + "url=$url" | Tee-Object $env:GITHUB_OUTPUT -Append } else { @@ -209,14 +207,13 @@ jobs: if: steps.target.outputs.latestTag != steps.target.outputs.originalTag id: pr run: | - Write-Host '::echo::on' if ('${{ steps.create-pr.outputs.pull-request-url }}' -ne '') { - "url=${{ steps.create-pr.outputs.pull-request-url }}" >> $env:GITHUB_OUTPUT + "url=${{ steps.create-pr.outputs.pull-request-url }}" | Tee-Object $env:GITHUB_OUTPUT -Append } elseif ('${{ steps.existing-pr.outputs.url }}' -ne '') { - "url=${{ steps.existing-pr.outputs.url }}" >> $env:GITHUB_OUTPUT + "url=${{ steps.existing-pr.outputs.url }}" | Tee-Object $env:GITHUB_OUTPUT -Append } else { diff --git a/updater/scripts/update-dependency.ps1 b/updater/scripts/update-dependency.ps1 index ff2f2c1..1080249 100644 --- a/updater/scripts/update-dependency.ps1 +++ b/updater/scripts/update-dependency.ps1 @@ -133,12 +133,11 @@ if ("$Tag" -eq "") $latestTag = $tags[-1] $latestTagNice = ($latestTag -match "^[0-9]") ? "v$latestTag" : $latestTag - Write-Host '::echo::on' - "originalTag=$originalTag" >> $env:GITHUB_OUTPUT - "latestTag=$latestTag" >> $env:GITHUB_OUTPUT - "latestTagNice=$latestTagNice" >> $env:GITHUB_OUTPUT - "url=$url" >> $env:GITHUB_OUTPUT - "mainBranch=$mainBranch" >> $env:GITHUB_OUTPUT + "originalTag=$originalTag" | Tee-Object $env:GITHUB_OUTPUT -Append + "latestTag=$latestTag" | Tee-Object $env:GITHUB_OUTPUT -Append + "latestTagNice=$latestTagNice" | Tee-Object $env:GITHUB_OUTPUT -Append + "url=$url" | Tee-Object $env:GITHUB_OUTPUT -Append + "mainBranch=$mainBranch" | Tee-Object $env:GITHUB_OUTPUT -Append if ("$originalTag" -eq "$latestTag") {