Skip to content

Fixup. Format code with Black #27

Fixup. Format code with Black

Fixup. Format code with Black #27

---
name: Code Formatting
on:
push:
branches: [master, develop]
workflow_dispatch:
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