Skip to content

Commit b0e71fc

Browse files
committed
feat: check code workflow
1 parent 85bc71b commit b0e71fc

File tree

2 files changed

+86
-5
lines changed

2 files changed

+86
-5
lines changed

.github/workflows/build.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ concurrency:
1818
cancel-in-progress: true
1919

2020
jobs:
21-
pre-release:
21+
# Runs before the build starts
22+
before-build:
2223
runs-on: ubuntu-latest
2324
steps:
2425
- name: Comment PR with build status
@@ -30,8 +31,9 @@ jobs:
3031
Currently building for this pull request!
3132
comment-tag: build
3233

33-
release:
34-
needs: pre-release
34+
# Runs the build
35+
build:
36+
needs: before-build
3537
runs-on: ${{ matrix.os }}
3638

3739
strategy:
@@ -115,8 +117,8 @@ jobs:
115117
dist/*.flatpak
116118
117119
# Runs after all builds complete
118-
comment-pr:
119-
needs: release
120+
after-build:
121+
needs: build
120122
runs-on: ubuntu-latest
121123
if: github.event_name == 'pull_request'
122124
steps:

.github/workflows/checks.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: Code Quality Checks
2+
3+
permissions:
4+
contents: write
5+
pull-requests: write
6+
7+
on:
8+
pull_request:
9+
types: [opened, synchronize, reopened]
10+
11+
workflow_dispatch:
12+
13+
# Cancel in-progress jobs when a new push is made to the same PR
14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
16+
cancel-in-progress: true
17+
18+
jobs:
19+
main-checks:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Check out Git repository
23+
uses: actions/checkout@v4
24+
25+
- name: Install Node.js
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: 22
29+
30+
- name: Setup Bun
31+
uses: oven-sh/setup-bun@v2
32+
with:
33+
bun-version: latest
34+
35+
- name: Install Dependencies
36+
run: bun install --development --frozen-lockfile
37+
38+
- name: Run Type Check
39+
run: bun run typecheck
40+
41+
- name: Run Lint
42+
run: bun run lint
43+
44+
format:
45+
runs-on: ubuntu-latest
46+
steps:
47+
- name: Check out Git repository
48+
uses: actions/checkout@v4
49+
with:
50+
ref: ${{ github.head_ref }}
51+
52+
- name: Install Node.js
53+
uses: actions/setup-node@v4
54+
with:
55+
node-version: 22
56+
57+
- name: Setup Bun
58+
uses: oven-sh/setup-bun@v2
59+
with:
60+
bun-version: latest
61+
62+
- name: Install Dependencies
63+
run: bun install --development --frozen-lockfile
64+
65+
- name: Format Code
66+
run: bun run format
67+
68+
- name: Check for changes
69+
id: git-check
70+
run: |
71+
git diff --exit-code || echo "changes=true" >> $GITHUB_OUTPUT
72+
73+
- name: Commit changes if any
74+
if: steps.git-check.outputs.changes == 'true'
75+
run: |
76+
git config --local user.email "[email protected]"
77+
git config --local user.name "github-actions"
78+
git commit -am "style: format code with prettier"
79+
git push

0 commit comments

Comments
 (0)