-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (36 loc) · 1.34 KB
/
format.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
name: "Prettier Formatter"
run-name: Formatter run by @${{ github.actor }}
on:
pull_request:
types: [opened, reopened, synchronize]
branches: [prod, dev]
jobs:
prettier:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- uses: actions/setup-node@v4
with:
node-version: "20"
- run: npm i -D prettier@latest prettier-plugin-tailwindcss
- run: npx prettier --write . --plugin=prettier-plugin-tailwindcss
# Building a multiline commit message
- run: 'echo "chore: apply formatting changes" >> commitmessage.txt'
- run: echo "[skip ci]" >> commitmessage.txt
# Create a multiline string to be used by the git-auto-commit Action
- name: Set commit message
id: commit_message_step
run: |
echo 'commit_message<<EOF' >> $GITHUB_OUTPUT
cat commitmessage.txt >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
# Quick and dirty step to get rid of the temporary file holding the commit message
- run: rm -rf commitmessage.txt
# Commit changes
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v5.0.1
with:
commit_message: ${{ steps.commit_message_step.outputs.commit_message }}
branch: ${{ github.head_ref }}