forked from EsupPortail/Esup-Pod
-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (56 loc) · 2.13 KB
/
code_formatting.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
---
name: Code Formatting
on:
push:
branches: [master, develop]
jobs:
code-formatting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: set git config
run: |
git config user.name github-actions
git config user.email [email protected]
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
# Prettify js+css code with prettier
- name: Running prettier
run: |
npx prettier --write pod/*/static/**/*.js
npx prettier --write pod/*/static/**/*.css
- name: Check for modified files
id: prettier-git-check
run: echo modified=$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi) >> $GITHUB_OUTPUT
- name: Push prettify changes
if: steps.prettier-git-check.outputs.modified == 'true'
run: |
git commit -am "Fixup. Format code with Prettier"
git push
# Prettify py code with black
- name: Install Black
run: |
python -m pip install --upgrade pip
pip install black
- name: Running Black
run: black . -l 90
- name: Check for modified files
id: black-git-check
run: echo modified=$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi) >> $GITHUB_OUTPUT
- name: Push black changes
if: steps.black-git-check.outputs.modified == 'true'
run: |
git commit -am "Fixup. Format code with Black"
git push
# Generate configuration doc
- name: Generate configuration doc in fr
run: |
pip install -r requirements.txt
python manage.py createconfiguration fr
- name: Check for modified files
id: config-git-check
run: echo modified=$(if git diff --quiet; then echo "false"; else echo "true"; fi) >> $GITHUB_OUTPUT
- name: Push auto-config changes
if: steps.config-git-check.outputs.modified == 'true'
run: |
git commit -am "Auto-update configuration files"
git push