From 3298209528eb566799936743e74517c203537227 Mon Sep 17 00:00:00 2001 From: Reuben Tier <64310361+TheOtterlord@users.noreply.github.com> Date: Thu, 3 Oct 2024 22:54:45 +0100 Subject: [PATCH] [ci] Automate the world (linting) (#322) * Add lint formatting * Fix workflow install * Apply suggestions from code review Co-authored-by: Adam Matthiesen * delete workflow * Add dispatch * on pull request * break stuff * fix stuff * [ci] lint * maybe fix more stuff * [ci] lint * delagate my own work * [ci] lint * hyphens save lives * delete tab * [ci] lint * restore the flow of time --------- Co-authored-by: Adam Matthiesen Co-authored-by: TheOtterlord Co-authored-by: StudioCMS --- .github/workflows/biome-linting.yml | 20 ------------- .github/workflows/format.yml | 44 +++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 20 deletions(-) delete mode 100644 .github/workflows/biome-linting.yml create mode 100644 .github/workflows/format.yml diff --git a/.github/workflows/biome-linting.yml b/.github/workflows/biome-linting.yml deleted file mode 100644 index a80d5f5f0..000000000 --- a/.github/workflows/biome-linting.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Biome Linting - -on: - push: - pull_request: - -jobs: - quality: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 - - - name: Setup Biome - uses: biomejs/setup-biome@1cbe33ead22c7a2fded3b52fa2893611c815c9b5 # v2 - with: - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Run Biome - run: biome ci . \ No newline at end of file diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml new file mode 100644 index 000000000..af60539dd --- /dev/null +++ b/.github/workflows/format.yml @@ -0,0 +1,44 @@ +name: 'Format Code' + +on: + workflow_dispatch: + push: + branches: + - main + +permissions: + contents: write + +jobs: + format: + runs-on: ubuntu-latest + env: + NODE_OPTIONS: "--max_old_space_size=4096" + steps: + - name: Check out code using Git + uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Setup PNPM + uses: pnpm/action-setup@v3 + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version-file: '.node-version' + cache: pnpm + - name: Install dependencies + run: pnpm ci:install + shell: bash + + - name: Format code + run: pnpm run lint:fix + - name: Commit changes + uses: stefanzweifel/git-auto-commit-action@v5 + with: + commit_message: '[ci] lint' + branch: ${{ github.head_ref }} + commit_user_name: astrolicious + commit_user_email: no-reply@studiocms.xyz + commit_author: StudioCMS