-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (52 loc) · 1.57 KB
/
format.yml
File metadata and controls
65 lines (52 loc) · 1.57 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
name: Code Formatting
on:
workflow_call:
workflow_dispatch:
jobs:
format:
runs-on: ubuntu-latest
continue-on-error: true
permissions:
contents: write
packages: read
env:
NODE_AUTH_TOKEN: ${{ secrets.GHCR_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v6
with:
# Bei PRs checkt GitHub automatisch den PR-Branch aus
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: 'lts/*'
registry-url: https://npm.pkg.github.com
scope: '@seenivers'
- name: Setup pnpm
uses: pnpm/action-setup@v5.0.0
with:
version: 10.32.1
- name: Install dependencies
run: pnpm install
- name: Run Prettier
run: pnpm prettier --write .
- name: Commit Changes
run: |
if [[ `git status --porcelain` ]]; then
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
git add .
git commit -m "chore(format): run Prettier to format codebase
- Applied Prettier formatting to ensure consistent code style"
else
echo "No changes to commit."
fi
- name: Pull remote changes (rebase)
if: success()
run: git pull --rebase origin main
- name: Push Changes
if: success() # Nur ausführen, wenn die vorherigen Schritte erfolgreich sind
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: git push origin HEAD