-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (46 loc) · 1.95 KB
/
regen.yml
File metadata and controls
53 lines (46 loc) · 1.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
name: regen
on:
schedule:
- cron: "0 7 * * 1"
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
regen:
name: bump protobuf schema pin
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Discover latest archive version
id: latest
run: |
current=$(grep -E 'readonly BUF_PY_VERSION="' scripts/regen.sh \
| sed -E 's/.*="([^"]+)".*/\1/')
echo "current=$current" >> "$GITHUB_OUTPUT"
# Buf does not expose a public version-list endpoint; we resolve
# `main` to a pinned ref by introspecting the redirect target.
latest=$(curl -sI \
"https://buf.build/gen/archive/openstatus/api/protocolbuffers/python/main.zip" \
| grep -i '^location:' | sed -E 's/.*\/([^/]+)\.zip.*/\1/' | tr -d '\r')
echo "latest=$latest" >> "$GITHUB_OUTPUT"
- name: No-op when already up to date
if: steps.latest.outputs.latest == steps.latest.outputs.current
run: echo "Already on ${{ steps.latest.outputs.current }}; nothing to do."
- name: Bump pin and regenerate
if: steps.latest.outputs.latest != steps.latest.outputs.current
run: |
sed -i -E "s/(readonly BUF_PY_VERSION=)\"[^\"]+\"/\1\"${{ steps.latest.outputs.latest }}\"/" \
scripts/regen.sh
bash scripts/regen.sh
- name: Open PR
if: steps.latest.outputs.latest != steps.latest.outputs.current
uses: peter-evans/create-pull-request@v6
with:
branch: regen/${{ steps.latest.outputs.latest }}
commit-message: "chore: bump buf schema to ${{ steps.latest.outputs.latest }}"
title: "chore: bump buf schema to ${{ steps.latest.outputs.latest }}"
body: |
Automated bump of the pinned `protocolbuffers/python` archive
version from `${{ steps.latest.outputs.current }}` to
`${{ steps.latest.outputs.latest }}`.