Skip to content

Commit 085c8ab

Browse files
ref: add workflow to create a version bump PR (#44998)
the idea is to add a shortcut to "wait for dependabot to open a PR" such that developers can bump internal libraries more rapidly (I tried this out in a personal repo, seems to work well assuming the permissions are correct)
1 parent 982f363 commit 085c8ab

File tree

2 files changed

+49
-1
lines changed

2 files changed

+49
-1
lines changed

.github/workflows/bump-version.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
on:
2+
workflow_dispatch:
3+
inputs:
4+
package:
5+
required: true
6+
type: string
7+
description: package name such as `sentry-arroyo`
8+
version:
9+
required: true
10+
type: string
11+
description: desired version such as `1.2.3`
12+
13+
# disable all permissions -- we use the PAT's permissions instead
14+
permissions: {}
15+
16+
jobs:
17+
bump-version:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
21+
with:
22+
token: ${{ secrets.BUMP_SENTRY_TOKEN }}
23+
- run: |
24+
set -euxo pipefail
25+
26+
git checkout -b "bot/bump-version/$PACKAGE/$VERSION"
27+
28+
re="$(sed 's/[_-]/[_-]/g' <<< "$PACKAGE")"
29+
sed -i "s/^$re==.*/$PACKAGE==$VERSION/g" -- requirements*.txt
30+
31+
git \
32+
-c user.name=getsentry-bot \
33+
-c user.email='[email protected]' \
34+
commit \
35+
--all \
36+
--message "ref: bump $PACKAGE to $VERSION" \
37+
--message "Co-Authored-By: $SENDER <[email protected]>"
38+
39+
git push origin HEAD --quiet
40+
41+
gh pr create --fill
42+
env:
43+
GH_TOKEN: ${{ secrets.BUMP_SENTRY_TOKEN }}
44+
PACKAGE: ${{ inputs.package }}
45+
VERSION: ${{ inputs.version }}
46+
SENDER: ${{ github.event.sender.login }}
47+
SENDER_ID: ${{ github.event.sender.id }}

.pre-commit-config.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,11 @@ repos:
6363
args: [ '--project', 'pyrightconfig-commithook.json' ]
6464

6565
- repo: https://github.com/python-jsonschema/check-jsonschema
66-
rev: 0.16.0
66+
rev: 0.21.0
6767
hooks:
6868
- id: check-github-actions
6969
- id: check-github-workflows
70+
args: [--verbose]
7071

7172
- repo: https://github.com/pre-commit/pre-commit-hooks
7273
rev: v4.3.0

0 commit comments

Comments
 (0)