Skip to content

Automatically update JavaScript bundle 🤖 beep boop #370

Automatically update JavaScript bundle 🤖 beep boop

Automatically update JavaScript bundle 🤖 beep boop #370

# Script to regenerate the TypeScript on the main branch, if it ever happens
# that the JS bundle we find there is out of sync.
name: Automatically update JavaScript bundle
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
update_javascript:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
name: Checkout branch (with token)
if: github.event_name == 'push'
with:
fetch-depth: 1
# We need to pass the token here -- the commit action below will not overwrite the token to push.
token: ${{ secrets.FELIENNE_GITHUB_ACCESS_TOKEN }}
- uses: actions/checkout@v3
name: Checkout branch (on pull requests)
if: github.event_name != 'push'
with:
fetch-depth: 1
- name: Install Nodejs dependencies
run: |
npm ci
- name: Set up Python 3.9
uses: actions/setup-python@v1
with:
python-version: 3.9
- name: Install Python dependencies
run: |
python3 -m pip install --upgrade pip
pip3 install -r requirements.txt
# This is necessary for the TypeScript to contain translations
# from Gettex.
- name: Update and compile Babel translations
run: |
pybabel extract -F babel.cfg -o messages.pot . --no-location --sort-output
pybabel update -i messages.pot -d translations -N --no-wrap
pybabel compile -f -d translations
- name: Compile TypeScript to JavaScript
run: build-tools/heroku/generate-grammars-and-js
- name: Commit changed files
uses: stefanzweifel/[email protected]
if: github.event_name == 'push'
with:
commit_message: Automatically update JavaScript bundle 🤖 beep boop
branch: ${{ github.ref_name }}
env:
# This is necessary to bypass branch protection (which will disallow non-reviewed pushes otherwise)
GITHUB_TOKEN: ${{ secrets.FELIENNE_GITHUB_ACCESS_TOKEN }}