More CI updates #5
Workflow file for this run
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: Build UI | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
workflow_dispatch: | |
inputs: | |
format_code: | |
description: 'Run Prettier to format code? (yes/no)' | |
required: true | |
default: 'no' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [20.x] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Build | |
working-directory: ./ui | |
run: | | |
npm install | |
npm run build | |
npx prettier --check . | |
format: | |
if: github.event_name == 'workflow_dispatch' && github.event.inputs.format_code == 'yes' | |
needs: build | |
runs-on: ubuntu-latest | |
permissions: | |
# Give the default GITHUB_TOKEN write permission to commit and push the | |
# added or changed files to the repository. | |
contents: write | |
strategy: | |
matrix: | |
node-version: [20.x] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.head_ref }} | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20.x' | |
- name: Format Code | |
working-directory: ./ui | |
run: | | |
npm install | |
npx prettier --write . | |
# Commit changes from prettier | |
- uses: stefanzweifel/git-auto-commit-action@v5 |