Skip to content

Commit 228c294

Browse files
authored
Workflow to check JS and PY code format (#242)
* fix css files * create workflow * format code using prettier * black ignore 3rd party folder * format py code using black * black exclude option in workflow * Don't format workflow files * Add contributing instructions to readme --------- Co-authored-by: WithoutPants <[email protected]>
1 parent 1c6875f commit 228c294

File tree

87 files changed

+43191
-31640
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+43191
-31640
lines changed

Diff for: .editorconfig

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_style = space
7+
indent_size = 2
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false

Diff for: .github/workflows/check_code_format.yml

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Check Code Format
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
permissions:
12+
contents: write
13+
14+
jobs:
15+
check_js_code_format:
16+
name: Check JS code format
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
24+
ref: ${{ github.head_ref }}
25+
26+
- name: Check format
27+
uses: creyD/[email protected]
28+
with:
29+
prettier_options: --check
30+
dry: true
31+
only_changed: true
32+
github_token: ${{ secrets.GITHUB_TOKEN }}
33+
34+
check_py_code_format:
35+
name: Check PY code format
36+
runs-on: ubuntu-latest
37+
needs: check_js_code_format
38+
39+
steps:
40+
- name: Checkout repository
41+
uses: actions/checkout@v4
42+
with:
43+
fetch-depth: 0
44+
ref: ${{ github.head_ref }}
45+
46+
- name: Check format
47+
uses: psf/black@stable
48+
with:
49+
options: '--exclude="3rd party"'
50+
src: "."

Diff for: .github/workflows/deploy.yml

+22-23
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Deploy repository to Github Pages
22

33
on:
44
push:
5-
branches: [ main, stable ]
5+
branches: [main, stable]
66

77
# Allows you to run this workflow manually from the Actions tab
88
workflow_dispatch:
@@ -17,27 +17,27 @@ jobs:
1717
build:
1818
runs-on: ubuntu-22.04
1919
steps:
20-
- name: Checkout main
21-
uses: actions/checkout@v2
22-
with:
23-
path: main
24-
ref: main
25-
fetch-depth: '0'
26-
- run: |
27-
cd main
28-
./build_site.sh ../_site/stable
29-
- name: Checkout dev
30-
uses: actions/checkout@v2
31-
with:
32-
path: dev
33-
# change this ref to whatever dev branch/tag we need when necessary
34-
ref: main
35-
fetch-depth: '0'
36-
- run: |
37-
cd dev
38-
../main/build_site.sh ../_site/develop
39-
- uses: actions/upload-pages-artifact@v2
40-
20+
- name: Checkout main
21+
uses: actions/checkout@v2
22+
with:
23+
path: main
24+
ref: main
25+
fetch-depth: "0"
26+
- run: |
27+
cd main
28+
./build_site.sh ../_site/stable
29+
- name: Checkout dev
30+
uses: actions/checkout@v2
31+
with:
32+
path: dev
33+
# change this ref to whatever dev branch/tag we need when necessary
34+
ref: main
35+
fetch-depth: "0"
36+
- run: |
37+
cd dev
38+
../main/build_site.sh ../_site/develop
39+
- uses: actions/upload-pages-artifact@v2
40+
4141
deploy:
4242
environment:
4343
name: github-pages
@@ -48,4 +48,3 @@ jobs:
4848
- name: Deploy to GitHub Pages
4949
id: deployment
5050
uses: actions/deploy-pages@v2
51-

Diff for: .gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
/_site
1+
/_site
2+
node_modules

Diff for: .prettierignore

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
*.md
2+
3+
# dependencies
4+
node_modules
5+
package-lock.json
6+
7+
# production
8+
dist
9+
10+
# workflows
11+
.github

0 commit comments

Comments
 (0)