Skip to content

Commit

Permalink
add validate workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
mikewuu committed Dec 28, 2023
1 parent 24e9882 commit 7c160ce
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Validate
on:
push:
branches:
- "**" # all branches
- "!main"
pull_request:
branches:
- main

jobs:
typecheck:
name: Typecheck
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18
registry-url: https://npm.pkg.github.com
- name: NPM Install
run: npm ci --ignore-scripts
env:
NODE_AUTH_TOKEN: ${{ secrets.GWM_GH_TOKEN}}
- name: Build
run: npm run build
- name: Check types...
run: npm run typecheck

format:
name: Format
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18
registry-url: https://npm.pkg.github.com
- name: NPM Install
run: npm ci --ignore-scripts
env:
NODE_AUTH_TOKEN: ${{ secrets.GWM_GH_TOKEN}}
- name: Format...
run: npm run format

- name: Commit and push changes (if any)
uses: stefanzweifel/git-auto-commit-action@v4.2.0
id: auto_commit_action
with:
commit_user_name: seambot
commit_user_email: devops@getseam.com
commit_author: Seam Bot <devops@getseam.com>
commit_message: ci - format code

- name: Success
if: steps.auto_commit_action.outputs.changes_detected == 'false'
run: echo "Format check... PASS!"

- name: Fail
if: steps.auto_commit_action.outputs.changes_detected == 'true'
run: echo "Fixed formatting, and pushed changes" && exit 1

0 comments on commit 7c160ce

Please sign in to comment.