Skip to content

Remove dependency on closure #471

Remove dependency on closure

Remove dependency on closure #471

Workflow file for this run

---
name: Autofix
"on":
push:
# Only targets main branch to avoid amplification effects of auto-fixing
# the exact same stuff in multiple non-rebased branches.
branches:
- main
jobs:
autofix:
uses: kdeldycke/workflows/.github/workflows/[email protected]
with:
gitignore-extra-categories: node
format-css:
name: Generate Pygment styles, format CSS files and create a PR
runs-on: ubuntu-22.04
steps:
- uses: actions/[email protected]
- uses: actions/[email protected]
with:
python-version: "3.12"
- name: Install uv
run: |
python -m pip install -r https://raw.githubusercontent.com/kdeldycke/workflows/v4.3.1/requirements/uv.txt
- name: Install Pygments
run: |
uv --no-progress venv --system
uv --no-progress pip install .
- name: Generate Pygments styles
run: |
for STYLE in $( uv --no-progress run -- pygmentize -L styles | grep -E '^\* .*\:$' | cut -d ' ' -f 2 | cut -d ':' -f 1 );
do
CSS_FILE="./plumage/static/css/pygments/$STYLE.css"
uv --no-progress run -- pygmentize -f html -S "$STYLE" -a ".pygments-style-$STYLE" > "$CSS_FILE"
# Crappy split of side-by-side declarations to please styleint.
sed -i "s/; /; \n/g" "$CSS_FILE"
done
- name: Install npm
run: |
sudo apt --quiet --yes install npm
- name: Install stylelint
run: |
npm install --save-dev stylelint stylelint-config-standard stylelint-config-sass-guidelines
- name: Autofix CSS
# Allow that step to fail so we can proceed with creating the auto-fix
# PR below.
run: |
npx stylelint --fix --config stylelint-config-standard "plumage/static/**/*.css" || true
npx stylelint --fix --config stylelint-config-sass-guidelines "plumage/static/**/*.scss" || true
- name: Discard all local changes but CSS files
run: |
# Remove untracked directories and files.
git clean -fd
# Temporarily stash our target files.
git stash -- '*.css'
git stash -- '*.scss'
# Reset all repository.
git checkout --force
# Restore modified files. Do not fail if no file has been stashed.
git stash pop || true
- uses: peter-evans/[email protected]
with:
assignees: ${{ github.actor }}
commit-message: "[autofix] Upgrade and format CSS style"
title: "[autofix] Upgrade and format CSS style"
body: >
<details><summary><code>Workflow metadata</code></summary>
> [Auto-generated on run `#${{ github.run_id }}`](${{ github.event.repository.html_url }}/actions/runs/${{
github.run_id }}) by `${{ github.job }}` job from [`autofix.yaml`](${{ github.event.repository.html_url
}}/blob/${{ github.sha }}/.github/workflows/autofix.yaml) workflow.
</details>
labels: "🤖 ci"
branch: autofix-css
format-jinja:
name: Format Jinja
runs-on: ubuntu-22.04
steps:
- uses: actions/[email protected]
- uses: actions/[email protected]
with:
python-version: "3.12"
- name: Install uv
run: |
python -m pip install -r https://raw.githubusercontent.com/kdeldycke/workflows/v4.3.1/requirements/uv.txt
- name: Install djlint
run: |
uv --no-progress venv --system
uv --no-progress pip install ".[test]"
- name: Autofix Jinja
run: >
uv --no-progress run -- djlint
--reformat
--profile jinja
--format-css
--format-js
--warn
plumage/templates/*.html
- uses: peter-evans/[email protected]
with:
assignees: ${{ github.actor }}
commit-message: "[autofix] Format Jinja"
title: "[autofix] Format Jinja"
body: >
<details><summary><code>Workflow metadata</code></summary>
> [Auto-generated on run `#${{ github.run_id }}`](${{ github.event.repository.html_url }}/actions/runs/${{
github.run_id }}) by `${{ github.job }}` job from [`autofix.yaml`](${{ github.event.repository.html_url
}}/blob/${{ github.sha }}/.github/workflows/autofix.yaml) workflow.
</details>
labels: "🤖 ci"
branch: autofix-jinja