Skip to content

Create some gh actions #1

Create some gh actions

Create some gh actions #1

Workflow file for this run

name: Linting & formatting
on:
push:
branches: ["master", "actions"]
workflow_dispatch:
jobs:
formatting:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: 9
- uses: actions/setup-node@v3
with:
node-version: 18.x
cache: "pnpm"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Format code
run: pnpm run format
- name: Check for Changes
id: check_changes
run: |
git diff --exit-code || echo "::set-output name=changes::true"
- name: Commit Changes
if: steps.check_changes.outputs.changes == 'true'
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add .
git commit -m "Auto-format code"
- name: Push Changes
if: steps.check_changes.outputs.changes == 'true'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref_name }}
lint:
runs-on: ubuntu-latest
needs: formatting
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: 8
- uses: actions/setup-node@v3
with:
node-version: 18.x
cache: "pnpm"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Lint it
run: pnpm run lint:no-fmt