Skip to content

Commit 4625fad

Browse files
authored
feat: add pr-strategy switch (#22)
1 parent 91ad943 commit 4625fad

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

.github/workflows/updater.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@ on:
2525
type: string
2626
required: false
2727
default: 'ubuntu-latest'
28+
pr-strategy:
29+
description: |
30+
How to handle PRs - can be either of the following:
31+
* create - create a new PR for new dependency versions as they are released - maintainers may merge or close older PRs manually
32+
* update - keep a single PR that gets updated with new dependency versions until merged - only the latest version update is available at any time
33+
type: string
34+
required: false
35+
default: create
2836
_workflow_version:
2937
description: 'Internal: specify github-workflows (this repo) revision to use when checking out scripts.'
3038
type: string
@@ -117,7 +125,13 @@ jobs:
117125
$mainBranch = $(git remote show origin | Select-String "HEAD branch: (.*)").Matches[0].Groups[1].Value
118126
Write-Host '::echo::on'
119127
Write-Host "::set-output name=baseBranch::$mainBranch"
120-
Write-Host "::set-output name=prBranch::deps/${{ inputs.path }}/${{ steps.target.outputs.latestTag }}"
128+
$prBranch = switch ('${{ inputs.pr-strategy }}')
129+
{
130+
'create' { 'deps/${{ inputs.path }}/${{ steps.target.outputs.latestTag }}' }
131+
'update' { 'deps/${{ inputs.path }}' }
132+
default { throw "Unkown PR strategy '${{ inputs.pr-strategy }}'." }
133+
}
134+
Write-Host "::set-output name=prBranch::$prBranch"
121135
122136
- name: Fetch an existing PR
123137
if: steps.target.outputs.latestTag != steps.target.outputs.originalTag

.github/workflows/workflow-tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ jobs:
1111
path: tests/sentry-cli.properties
1212
name: CLI
1313
pattern: '^2\.0\.'
14+
pr-strategy: update
1415
_workflow_version: ${{ github.sha }}
1516
secrets:
1617
api-token: ${{ github.token }}

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ jobs:
6868
* type: string
6969
* required: false
7070
* default: ubuntu-latest
71+
* `pr-strategy`: How to handle PRs.
72+
Can be either of the following:
73+
* `create` (default) - create a new PR for new dependency versions as they are released - maintainers may merge or close older PRs manually
74+
* `update` - keep a single PR that gets updated with new dependency versions until merged - only the latest version update is available at any time
75+
7176

7277
### Secrets
7378

0 commit comments

Comments
 (0)