Skip to content

Commit 24e901b

Browse files
committed
2 parents 3a5430e + cfec038 commit 24e901b

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

.github/workflows/formatter.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Static checks
2+
3+
on:
4+
pull_request:
5+
branches: [ "main" ]
6+
7+
workflow_dispatch:
8+
inputs:
9+
code_check:
10+
description: 'Perform a static check?'
11+
default: 'true'
12+
13+
jobs:
14+
static-checks:
15+
permissions:
16+
contents: write
17+
pull-requests: write
18+
19+
name: 'Static checks'
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v4
23+
- uses: Scony/godot-gdscript-toolkit@master
24+
25+
- run: sudo apt-get install gh -y
26+
27+
- name: Format code
28+
if: github.event_name == 'workflow_dispatch'
29+
run: |
30+
gdformat src/
31+
32+
if [[ -n $(git status --porcelain) ]]; then
33+
BRANCH_NAME=static/check-$(date +%s)
34+
35+
git config user.name "github-actions"
36+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
37+
git checkout -b $BRANCH_NAME
38+
39+
git commit -am "chore: format GDScript files"
40+
git remote set-url origin https://x-access-token:${{ secrets.SYNCER_TOKEN }}@github.com/${{ github.repository }}
41+
git push --set-upstream origin $BRANCH_NAME
42+
43+
echo "${{ secrets.SYNCER_TOKEN }}" | gh auth login --with-token
44+
gh pr create \
45+
--title "chore: format GDScript files" \
46+
--body "Automatically formatted GDScript files using gdformat." \
47+
--base main \
48+
--head $BRANCH_NAME
49+
else
50+
echo "No formatting changes."
51+
fi
52+
53+
- name: Lint code
54+
run: |
55+
gdlint src/ || true

0 commit comments

Comments
 (0)