ci: consolidate format & generate workflows (#485)

This commit is contained in:
uncenter authored and GitHub committed 2024-01-31 17:14:18 +00:00
1 parent 2fbc661e1d
commit 3feeb070e5
2 files changed
+23 -41

No files matched your search

-30
View File
@@ -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>"
@@ -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: Push changes
uses: stefanzweifel/git-auto-commit-action@v5
if: ${{ github.repository == 'catppuccin/userstyles' && github.ref == 'refs/heads/main' && env.HAS_USERSTYLES_TOKEN }}
- name: Commit changes
uses: EndBug/add-and-commit@v9
with:
commit_message: "chore: generate health files"
commit_author: "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>"
branch: ${{ github.ref }}
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