diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml deleted file mode 100644 index 9bfdabdb98..0000000000 --- a/.github/workflows/format.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: Format - -on: - push: - branches: [main] - -jobs: - format: - name: Format userstyles - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - with: - token: ${{ secrets.USERSTYLES_TOKEN }} - - - name: Setup Node.js - uses: actions/setup-node@v3 - - - name: Format userstyles - run: npx prettier --write . - - - name: Pull changes - run: git pull - - - name: Push changes - uses: stefanzweifel/git-auto-commit-action@v5 - with: - commit_message: "style: format code with prettier" - commit_author: "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>" diff --git a/.github/workflows/generate.yml b/.github/workflows/generate-format.yml similarity index 59% rename from .github/workflows/generate.yml rename to .github/workflows/generate-format.yml index 25cb5603d1..30a0aac6e3 100644 --- a/.github/workflows/generate.yml +++ b/.github/workflows/generate-format.yml @@ -1,17 +1,16 @@ -name: File Generator +name: Generate Health Files & Format on: workflow_dispatch: push: - paths: - - "scripts/**/*" + branches: [main] env: HAS_USERSTYLES_TOKEN: ${{ secrets.USERSTYLES_TOKEN != '' }} jobs: - generate-health-files: - name: Generate health files + 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 @@ -37,10 +36,23 @@ jobs: - 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 - uses: stefanzweifel/git-auto-commit-action@v5 if: ${{ github.repository == 'catppuccin/userstyles' && github.ref == 'refs/heads/main' && env.HAS_USERSTYLES_TOKEN }} - with: - commit_message: "chore: generate health files" - commit_author: "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>" - branch: ${{ github.ref }} + run: git push origin "HEAD:${{ github.ref }}" --atomic