Skip to content

Commit 08d3423

Browse files
committed
Added Workflow
1 parent 929f455 commit 08d3423

File tree

1 file changed

+82
-0
lines changed

1 file changed

+82
-0
lines changed

.github/workflows/ci.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: CI
2+
3+
on: [push, pull_request]
4+
5+
permissions:
6+
actions: write
7+
checks: write
8+
contents: write
9+
deployments: write
10+
id-token: write
11+
issues: write
12+
discussions: write
13+
packages: write
14+
pages: write
15+
pull-requests: write
16+
repository-projects: write
17+
security-events: write
18+
statuses: write
19+
20+
jobs:
21+
linter:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v3
25+
with:
26+
path: scprp
27+
28+
- uses: leafo/[email protected]
29+
with:
30+
luaVersion: "5.2"
31+
32+
- uses: leafo/[email protected]
33+
34+
- name: Pull gluacheck
35+
uses: actions/checkout@v3
36+
with:
37+
repository: LiliaFramework/GluaCheck
38+
path: luacheck
39+
40+
- name: Build gluacheck
41+
working-directory: luacheck
42+
run: luarocks make
43+
44+
- name: Lint
45+
working-directory: scprp
46+
run: |
47+
luacheck . --no-redefined \
48+
--no-global --no-self \
49+
--no-max-line-length --no-max-code-line-length \
50+
--no-max-string-line-length --no-max-comment-line-length \
51+
--no-max-cyclomatic-complexity
52+
53+
prettyprint:
54+
runs-on: ubuntu-latest
55+
needs: linter
56+
steps:
57+
- uses: actions/checkout@v3
58+
with:
59+
path: scprp
60+
61+
- name: Lint with GLuaLint
62+
working-directory: scprp
63+
run: |
64+
glualint --pretty-print .
65+
66+
- name: Configure Git
67+
run: |
68+
git config --global user.email "[email protected]"
69+
git config --global user.name "GitHub Actions"
70+
71+
- name: Commit and Push Changes
72+
env:
73+
GITHUB_TOKEN: ${{ secrets.LiliaGitSecret }}
74+
working-directory: scprp
75+
run: |
76+
if [ -n "$(git status --porcelain)" ]; then
77+
git add .
78+
git commit -m "Pretty Printed"
79+
git push https://${{ secrets.LiliaGitSecret }}@github.com/${{ github.repository }}.git main
80+
else
81+
echo "No changes to commit"
82+
fi

0 commit comments

Comments
 (0)