Regen #11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Regen | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 5 * * 1' # At 05:00 on Monday. | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
regen: | |
name: Regen | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.BELLA_ACTION_TOKEN }} | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- uses: bahmutov/npm-install@v1 | |
- name: Build SourceDocs | |
run: | | |
git clone https://github.com/magicbell/SourceDocs.git --branch magicbell /tmp/sourcedocs | |
pushd /tmp/sourcedocs | |
make build | |
cp .build/release/sourcedocs /usr/local/bin | |
popd | |
- name: Regen | |
run: yarn codegen | |
env: | |
LIBLAB_TOKEN: ${{ secrets.LIBLAB_ACTION_TOKEN }} | |
- name: Generate Changeset | |
shell: bash | |
run: | | |
TIMESTAMP=$(date +%s) | |
mkdir -p .changeset | |
PACKAGE_NAME=$(jq -r '.name' package.json) | |
FILE_NAME=".changeset/auto-bump-${PACKAGE_NAME}-${TIMESTAMP}.md" | |
if [ -z "$PACKAGE_NAME" ] || [ "$PACKAGE_NAME" == "null" ]; then | |
echo "Warning: Could not find 'name' in 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" | |
- 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 sdk' | |
body: 'Automated PR to update the generated SDK' | |
commit-message: 'chore: regen sdk' | |
committer: 'MagicBella <${{ secrets.BELLA_EMAIL_ADDRESS }}>' | |
author: 'MagicBella <${{ secrets.BELLA_EMAIL_ADDRESS }}>' |