Skip to content

Commit 229ec49

Browse files
committed
fix(ci): route club calendar versioning through PR flow
Made-with: Cursor
1 parent c13ca30 commit 229ec49

1 file changed

Lines changed: 25 additions & 9 deletions

File tree

.github/workflows/club-calendar-version.yml

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,21 +41,37 @@ jobs:
4141
id: bump
4242
run: node scripts/sync-club-calendar-version.mjs
4343

44-
- name: Commit version bump
44+
- name: Create version bump pull request
4545
if: steps.bump.outputs.changed == 'true'
46-
run: |
47-
git config user.name "github-actions[bot]"
48-
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
49-
git add package.json app.json package-lock.json
50-
git commit -m "chore(version): club calendar ${{ steps.bump.outputs.version }}"
51-
git push
46+
uses: peter-evans/create-pull-request@v6
47+
with:
48+
token: ${{ secrets.GITHUB_TOKEN }}
49+
commit-message: "chore(version): club calendar ${{ steps.bump.outputs.version }}"
50+
title: "chore(version): club calendar ${{ steps.bump.outputs.version }}"
51+
body: |
52+
Automated club calendar version sync.
53+
54+
- Updates `package.json`, `app.json`, and `package-lock.json`
55+
- Computed by `scripts/sync-club-calendar-version.mjs`
56+
branch: automation/club-calendar-version
57+
base: main
58+
labels: automated
59+
delete-branch: true
5260

61+
release:
62+
if: "${{ github.event_name == 'push' && github.event.head_commit != null && contains(github.event.head_commit.message, 'chore(version): club calendar') }}"
63+
runs-on: ubuntu-latest
64+
steps:
5365
- name: Create GitHub Release
54-
if: steps.bump.outputs.changed == 'true'
5566
env:
5667
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
68+
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
5769
run: |
58-
VERSION="${{ steps.bump.outputs.version }}"
70+
VERSION="$(echo "$COMMIT_MESSAGE" | sed -E 's/^chore\(version\): club calendar ([0-9]+\.[0-9]+\.[0-9]+).*$/\1/')"
71+
if [ -z "$VERSION" ]; then
72+
echo "Could not parse semantic version from commit message: $COMMIT_MESSAGE"
73+
exit 1
74+
fi
5975
gh release create "v${VERSION}" \
6076
--title "BSR Solar Car 2 v${VERSION}" \
6177
--notes "Club calendar version — see \`scripts/club-version-policy.json\` for the numbering rules (America/Chicago date)." \

0 commit comments

Comments
 (0)