Skip to content

Commit 6d81fdf

Browse files
committed
feat: regen workflow
1 parent 9e8b896 commit 6d81fdf

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

.github/workflows/regen.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Regen
2+
on:
3+
workflow_dispatch:
4+
schedule:
5+
- cron: '0 5 * * 1' # At 05:00 on Monday.
6+
7+
permissions:
8+
contents: write
9+
pull-requests: write
10+
11+
jobs:
12+
regen:
13+
name: Regen
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
with:
19+
token: ${{ secrets.BELLA_ACTION_TOKEN }}
20+
21+
- uses: actions/setup-node@v4
22+
with:
23+
node-version: 20
24+
- uses: bahmutov/npm-install@v1
25+
26+
- name: Regen `magicbell-java-client`
27+
run: yarn codegen
28+
env:
29+
LIBLAB_TOKEN: ${{ secrets.LIBLAB_ACTION_TOKEN }}
30+
31+
- name: Generate Changeset
32+
shell: bash
33+
run: |
34+
TIMESTAMP=$(date +%s)
35+
mkdir -p .changeset
36+
PACKAGE_NAME=$(jq -r '.name' package.json)
37+
FILE_NAME=".changeset/auto-bump-${PACKAGE_NAME}-${TIMESTAMP}.md"
38+
39+
if [ -z "$PACKAGE_NAME" ] || [ "$PACKAGE_NAME" == "null" ]; then
40+
echo "Warning: Could not find 'name' in package.json. Skipping..."
41+
continue
42+
fi
43+
44+
# Create the Changeset file with the correct package name and minor bump
45+
{
46+
echo "---"
47+
echo ""\"$PACKAGE_NAME\"": minor"
48+
echo "---"
49+
echo ""
50+
echo "Automatic minor version bump for changes in \`$PACKAGE_NAME\`."
51+
} > "$FILE_NAME"
52+
53+
echo "Created Changeset: $FILE_NAME"
54+
55+
- name: Create Pull Request
56+
uses: peter-evans/create-pull-request@v7
57+
with:
58+
token: ${{ secrets.BELLA_ACTION_TOKEN }}
59+
branch: 'feature/regen-sdks'
60+
base: 'main'
61+
title: 'chore: regen sdk'
62+
body: 'Automated PR to update the generated SDK'
63+
commit-message: 'chore: regen sdk'
64+
committer: 'MagicBella <${{ secrets.BELLA_EMAIL_ADDRESS }}>'
65+
author: 'MagicBella <${{ secrets.BELLA_EMAIL_ADDRESS }}>'

0 commit comments

Comments
 (0)