-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
82876a2
commit 84d8006
Showing
1 changed file
with
39 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,39 @@ | ||
- uses: actions/checkout@v4 | ||
- uses: JohnnyMorganz/stylua-action@v4 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
version: latest # NOTE: we recommend pinning to a specific version in case of formatting changes | ||
# CLI arguments | ||
args: --check . | ||
name: formatter-all | ||
|
||
on: | ||
push: | ||
branches: [ main, dev ] | ||
pull_request: | ||
types: [ labeled ] | ||
|
||
jobs: | ||
formatter: | ||
name: formatter | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
if: ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.label.name == 'format_all') }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.head_ref }} | ||
fetch-depth: 0 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: "16" | ||
- name: Install stylua and format files | ||
uses: JohnnyMorganz/stylua-action@v3 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
version: v0.18.0 | ||
args: -- . | ||
- name: Format files with Prettier | ||
run: | | ||
npx prettier --write '**/*.{ts,js,css,html}' | ||
- name: Update repo before push | ||
run: | | ||
git pull | ||
- name: Commit changes and push current branch | ||
uses: stefanzweifel/git-auto-commit-action@v4 |