From 7c160ce45217ebef1e8d2545db4caa93a8e853ea Mon Sep 17 00:00:00 2001 From: Mike Wu Date: Thu, 28 Dec 2023 18:29:15 +0900 Subject: [PATCH] add validate workflow --- .github/workflows/validate.yml | 65 ++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 .github/workflows/validate.yml diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml new file mode 100644 index 0000000..b58597b --- /dev/null +++ b/.github/workflows/validate.yml @@ -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 + 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