Skip to content

Regen

Regen #83

Workflow file for this run

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@v5
with:
token: ${{ secrets.BELLA_ACTION_TOKEN }}
- uses: actions/setup-node@v4
with:
node-version: 22.18.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)
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@v7
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 }}>'