name: Generate Health Files & Format on: workflow_dispatch: push: branches: [main] env: HAS_USERSTYLES_TOKEN: ${{ secrets.USERSTYLES_TOKEN != '' }} jobs: generate-health-files-and-format: name: Generate health files & format runs-on: ubuntu-latest permissions: # Give the default GITHUB_TOKEN write permission to commit and push the # added or changed files to the repository. contents: write steps: - uses: actions/checkout@v4 if: env.HAS_USERSTYLES_TOKEN with: token: ${{ secrets.USERSTYLES_TOKEN }} ref: ${{ github.ref }} - uses: actions/checkout@v4 if: env.HAS_USERSTYLES_TOKEN == 'false' with: ref: ${{ github.ref }} - name: Setup Deno uses: nekowinston/setup-deno@main with: deno-version: v1.x - name: Generate health files run: deno task ci:generate - name: Commit changes uses: EndBug/add-and-commit@v9 with: message: "chore: generate health files" default_author: github_actions push: false - name: Format files run: npx prettier --write . - name: Commit changes uses: EndBug/add-and-commit@v9 with: message: "style: format code with prettier" default_author: github_actions push: false - name: Push changes if: ${{ github.repository == 'catppuccin/userstyles' && github.ref == 'refs/heads/main' && env.HAS_USERSTYLES_TOKEN }} run: git push origin "HEAD:${{ github.ref }}" --atomic