Skip to content

Commit ca115b9

Browse files
Add GitHub Actions workflow for linting code.
1 parent 6079124 commit ca115b9

File tree

2 files changed

+47
-6
lines changed

2 files changed

+47
-6
lines changed

.github/workflows/build_docs.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,21 @@ jobs:
5252
if [ -d "public" ]; then
5353
echo "public directory exists. Proceeding with deployment."
5454
55-
5655
find . -maxdepth 1 ! -name '.git' ! -name '.' ! -name 'public' -exec rm -rf {} +
56+
5757
cp -r public/* .
58-
touch .nojekyll
5958
60-
ls -la .
59+
touch .nojekyll
6160
6261
git add .
63-
git commit -m "Deploy updated documentation to GitHub Pages from commit $GITHUB_SHA"
64-
git push origin gh-pages --force
62+
if git diff --cached --quiet; then
63+
echo "No changes to commit. Skipping deployment."
64+
exit 0
65+
else
66+
git commit -m "Deploy updated documentation to GitHub Pages from commit $GITHUB_SHA"
67+
git push origin gh-pages --force
68+
fi
6569
else
6670
echo "Error: 'public/' directory does not exist during deployment."
6771
exit 1
6872
fi
69-

.github/workflows/lint_code.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Lint Code
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
lint:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v3
18+
19+
- name: Set up Python
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: '3.10'
23+
24+
- name: Install linting dependencies
25+
run: |
26+
pip install black==24.10.0 isort==5.13.2 ruff==0.6.9
27+
28+
- name: Run Black
29+
run: |
30+
black --check .
31+
32+
- name: Run isort
33+
run: |
34+
isort --check-only .
35+
36+
- name: Run Ruff
37+
run: |
38+
ruff check .

0 commit comments

Comments
 (0)