Skip to content

Linkout wip

Linkout wip #1939

name: Format website code
on:
workflow_dispatch:
pull_request:
types: [synchronize, labeled]
paths:
- "website/**"
jobs:
format:
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'format_me'))
permissions:
contents: write
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version-file: ./website/.nvmrc
- name: Cache .npm
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('website/**/package-lock.json') }}
- name: NPM install and format website
working-directory: website
run: |
npm install
npm run format
- name: Commit and Push Changes
run: |
git config --global user.name 'Loculus bot'
git config --global user.email '[email protected]'
git add -A
git commit -m "Automated code formatting" || echo "No changes to commit"
git push origin HEAD:${{ github.head_ref }}