-
Notifications
You must be signed in to change notification settings - Fork 11
75 lines (64 loc) · 2.32 KB
/
Copy pathregen.yml
File metadata and controls
75 lines (64 loc) · 2.32 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: Regen
on:
workflow_dispatch:
schedule:
- cron: '0 6 * * 1' # At 06:00 on Monday.
permissions:
contents: write
pull-requests: write
jobs:
regen:
name: Regen
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
token: ${{ secrets.BELLA_ACTION_TOKEN }}
- uses: actions/setup-node@v6
with:
node-version: 24.16.0
- uses: bahmutov/npm-install@v1
- name: Build codegen
run: yarn --cwd packages/codegen build
- name: Regen `magicbell-js`
run: yarn --cwd packages/magicbell-js codegen
env:
LIBLAB_TOKEN: ${{ secrets.LIBLAB_ACTION_TOKEN }}
- name: Generate Changesets
shell: bash
run: |
CHANGED_PACKAGES=$(git diff --name-only | grep '^packages/' | awk -F/ '{print $2}' | sort -u || true)
if [ -z "$CHANGED_PACKAGES" ]; then
echo "No package changes detected; skipping changeset generation."
exit 0
fi
TIMESTAMP=$(date +%s)
mkdir -p .changeset
for PACKAGE in $CHANGED_PACKAGES; do
PACKAGE_NAME=$(jq -r '.name' packages/$PACKAGE/package.json)
FILE_NAME=".changeset/auto-bump-${PACKAGE}-${TIMESTAMP}.md"
if [ -z "$PACKAGE_NAME" ] || [ "$PACKAGE_NAME" == "null" ]; then
echo "Warning: Could not find 'name' in packages/$PACKAGE/package.json. Skipping..."
continue
fi
# Create the Changeset file with the correct package name and minor bump
{
echo "---"
echo "\"$PACKAGE_NAME\": minor"
echo "---"
echo ""
echo "Automatic minor version bump for changes in \`$PACKAGE_NAME\`."
} > "$FILE_NAME"
echo "Created Changeset: $FILE_NAME"
done
- name: Create Pull Request
uses: peter-evans/create-pull-request@v8
with:
token: ${{ secrets.BELLA_ACTION_TOKEN }}
branch: 'feature/regen-sdks'
base: 'main'
title: 'chore: regen sdks'
body: 'Automated PR to update the generated SDKs'
commit-message: 'chore: regen sdks'
committer: 'MagicBella <${{ secrets.BELLA_EMAIL_ADDRESS }}>'
author: 'MagicBella <${{ secrets.BELLA_EMAIL_ADDRESS }}>'