Polytoria / Docs

Polytoria Scripting API documentation
https://docs.polytoria.com
7 stars 15 forks source link

[Feature Request] Running prettier on every commit using actions #77

Closed hawl1 closed 5 months ago

hawl1 commented 6 months ago

Since baggy loves prettier (in a romantical way, jk) it would be a good idea to run prettier at every commit using actions.

willemsteller commented 6 months ago

@StarManTheGamer

hawl1 commented 5 months ago

omgg willemsteller commented on my issue

name: Prettier Format and Commit

on:
  push:
    branches:
      - main
      - "refs/heads/*"

jobs:
  prettier:
    runs-on: ubuntu-latest

    steps:
    - name: Checkout repository
      uses: actions/checkout@v4

    - name: Set up Node.js
      uses: actions/setup-node@v4
      with:
        node-version: 'latest'

    - name: Install dependencies
      run: npm install

    - name: Run Prettier
      run: npx prettier --write .

    - name: Commit changes
      run: |
        git config --global user.name "github-actions[bot]"
        git config --global user.email "github-actions[bot]@users.noreply.github.com"
        git add .
        git commit -m "chore: format code with Prettier"
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

    - name: Push changes
      run: git push
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}