diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6753a42..de32d82 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -33,6 +33,6 @@ jobs: - name: Process test results if: ${{ success() || failure() }} shell: pwsh - run: ./eng/process-test-results.ps1 + run: ./eng/process-test-results.ps1 -Branch "${{ github.head_ref || github.ref_name }}" env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/eng/process-test-results.ps1 b/eng/process-test-results.ps1 index ebcf13e..8e34f45 100644 --- a/eng/process-test-results.ps1 +++ b/eng/process-test-results.ps1 @@ -1,5 +1,6 @@ [CmdletBinding(PositionalBinding=$false)] param ( + $branch = $null, [switch]$dry = $false ) @@ -8,7 +9,8 @@ $ErrorActionPreference = "Stop" # If snapshots are changed, create a pull request. if (git status --porcelain) { - $currentBranch = $(git branch --show-current) + $currentBranch = $branch ?? $(git branch --show-current) + Write-Output "Branch: '$currentBranch'" # Avoid making new PR against snapshot-updating PR. if ($currentBranch.StartsWith("update-snapshots")) { @@ -27,7 +29,7 @@ if (git status --porcelain) { git commit -am "Update snapshots" git push -f origin update-snapshots/$currentBranch gh pr create --base $currentBranch --title "Update snapshots" ` - --body "Generate automatically by script ``process-test-results.ps1``." + --body "Generated automatically by script ``process-test-results.ps1``." } finally { git checkout $currentBranch }