Skip to content

Update model multipliers #57

Update model multipliers

Update model multipliers #57

name: Update model multipliers
on:
schedule:
# Run daily at 08:10 UTC, shortly after the source repo typically publishes.
- cron: '10 8 * * *'
workflow_dispatch:
push:
branches:
- main
paths:
- .github/workflows/update-model-multipliers.yml
- scripts/update-model-multipliers.py
permissions:
contents: write
pull-requests: write
jobs:
update-model-multipliers:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: '3.x'
- name: Check for updates and generate model multipliers
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: python scripts/update-model-multipliers.py
- name: Create pull request
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
if [[ -n $(git status --porcelain) ]]; then
echo "Changes detected, creating PR" >> $GITHUB_STEP_SUMMARY
# Configure git
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
# Create a unique branch
BRANCH_NAME="update/model-multipliers-$(date +%Y%m%d%H%M%S)"
git checkout -b "$BRANCH_NAME"
# Commit and push
git add src/lib/model-multipliers.generated.ts
git commit -m ":memo: Update model multipliers from rajbos/github-copilot-model-notifier"
git push origin "$BRANCH_NAME"
# Create PR
gh pr create \
--title "Update model multipliers from rajbos/github-copilot-model-notifier" \
--body "Automated update of model multipliers from the latest release of [rajbos/github-copilot-model-notifier](https://github.com/rajbos/github-copilot-model-notifier/releases/latest). Generated by GitHub Actions." \
--head "$BRANCH_NAME" \
--base main
else
echo "No changes detected." >> $GITHUB_STEP_SUMMARY
fi