Skip to content

Commit 6a94e2c

Browse files
m-aciekCopilot
andauthored
HTML/Jinja lint & format, pin pre-commit and GH Actions to commit hashes (#173)
* Add new linter * reformat * add meta keywords, move styles to stylesheet, add height and width for logo, set endblock names, add ignore for flask internal links * bump style cache version * update logo dimensions in base.html and clean up CSS * endblock name * move link color on card to the stylesheet, quotes, centering, blocks * use spaceless tags inside attribute values * add indentation setting to djlint configuration * reformat * Merge branch 'main' into jinja-lint (resolve conflicts) Agent-Logs-Url: https://github.com/python-docs-translations/dashboard/sessions/5fd15b20-fc7a-43ce-9dce-7efaf823b384 Co-authored-by: m-aciek <9288014+m-aciek@users.noreply.github.com> * Add __pycache__ to .gitignore and remove from tracking Agent-Logs-Url: https://github.com/python-docs-translations/dashboard/sessions/5fd15b20-fc7a-43ce-9dce-7efaf823b384 Co-authored-by: m-aciek <9288014+m-aciek@users.noreply.github.com> * pre-commit autoupdate --freeze * set the dependabot cooldown * uvx gha-update --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: m-aciek <9288014+m-aciek@users.noreply.github.com>
1 parent 3281ff3 commit 6a94e2c

12 files changed

Lines changed: 285 additions & 233 deletions

.github/dependabot.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ updates:
88
actions:
99
patterns:
1010
- "*"
11+
cooldown:
12+
default-days: 7

.github/workflows/cleanup-pr-preview.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ jobs:
1010
permissions:
1111
contents: write
1212
steps:
13-
- uses: actions/checkout@v6
13+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1414
with:
1515
ref: gh-pages
1616
- run: git config user.name "github-actions[bot]"
1717
- run: git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
1818
- run: git rm -rf ${{ github.event.number }}
1919
- run: git commit -m 'Cleaning up gh-pages after ${{ github.event.number }}'
20-
- uses: ad-m/github-push-action@master
20+
- uses: ad-m/github-push-action@881a6320fdb16eb5318c5054f31c218aec2b324c # v1.3.0
2121
with:
2222
branch: gh-pages

.github/workflows/lint.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ jobs:
1515
runs-on: ubuntu-latest
1616

1717
steps:
18-
- uses: actions/checkout@v6
18+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1919
with:
2020
persist-credentials: false
21-
- uses: actions/setup-python@v6
21+
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
2222
with:
2323
python-version: "3.x"
24-
- uses: tox-dev/action-pre-commit-uv@v1
24+
- uses: tox-dev/action-pre-commit-uv@41a04ab74d5ec7ca33c8db8a59b6e3291d576033 # v1.0.4

.github/workflows/run-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ jobs:
1111
runs-on: ubuntu-latest
1212

1313
steps:
14-
- uses: actions/checkout@v6
14+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1515
with:
1616
persist-credentials: false
17-
- uses: actions/setup-python@v6
17+
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
1818
with:
1919
python-version: "3.x"
2020
- run: pip install -r requirements.txt

.github/workflows/update.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@ jobs:
1313
contents: write
1414
pull-requests: write
1515
steps:
16-
- uses: actions/setup-python@v6
16+
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
1717
with:
1818
python-version: "3.x"
19-
- uses: astral-sh/setup-uv@v7
20-
- uses: actions/checkout@v6
19+
- uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
20+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2121
- run: sudo apt-get install -y gettext
2222
- run: pip install -r requirements.txt
2323
- run: uv run generate.py # generates index.html and index.json
2424
- name: Deploy 🚀
2525
if: github.event_name != 'pull_request'
26-
uses: JamesIves/github-pages-deploy-action@v4
26+
uses: JamesIves/github-pages-deploy-action@d92aa235d04922e8f08b40ce78cc5442fcfbfa2f # v4.8.0
2727
with:
2828
folder: build
2929
clean: false
@@ -32,7 +32,7 @@ jobs:
3232
- name: Deploy to subdirectory if pull request 🚀
3333
# This does not work for PRs from forks
3434
if: github.event_name == 'pull_request' && !github.event.pull_request.head.repo.fork
35-
uses: JamesIves/github-pages-deploy-action@v4
35+
uses: JamesIves/github-pages-deploy-action@d92aa235d04922e8f08b40ce78cc5442fcfbfa2f # v4.8.0
3636
with:
3737
folder: build
3838
target-folder: ${{ github.ref_name }}
@@ -42,7 +42,7 @@ jobs:
4242
- name: Update PR description if pull request
4343
# This does not work for PRs from forks
4444
if: github.event_name == 'pull_request' && !github.event.pull_request.head.repo.fork
45-
uses: chabroA/action-append-pr-description@v1.2.1
45+
uses: chabroA/action-append-pr-description@9e3784d5a06b65d9294b9dcee4633ab81a362e8f # v1.2.1
4646
with:
4747
auth: ${{ secrets.GITHUB_TOKEN }}
4848
repo: ${{ github.event.repository.name }}
@@ -59,7 +59,7 @@ jobs:
5959
- run: uv run generate_build_details.py # generates build-details.html
6060
- name: Deploy build details view 🚀
6161
if: github.event_name != 'pull_request'
62-
uses: JamesIves/github-pages-deploy-action@v4
62+
uses: JamesIves/github-pages-deploy-action@d92aa235d04922e8f08b40ce78cc5442fcfbfa2f # v4.8.0
6363
with:
6464
folder: build
6565
clean: false
@@ -68,14 +68,14 @@ jobs:
6868
- name: Deploy metadata view to subdirectory if pull request 🚀
6969
# This does not work for PRs from forks
7070
if: github.event_name == 'pull_request' && !github.event.pull_request.head.repo.fork
71-
uses: JamesIves/github-pages-deploy-action@v4
71+
uses: JamesIves/github-pages-deploy-action@d92aa235d04922e8f08b40ce78cc5442fcfbfa2f # v4.8.0
7272
with:
7373
folder: build
7474
target-folder: ${{ github.ref_name }}
7575
clean: false
7676
git-config-name: github-actions[bot]
7777
git-config-email: 41898282+github-actions[bot]@users.noreply.github.com
78-
- uses: actions/upload-artifact@v7
78+
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
7979
if: always()
8080
with:
8181
name: build

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
build
22
clones
33
venv
4+
__pycache__
5+
*.pyc

.pre-commit-config.yaml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
3-
rev: v0.15.9
3+
rev: 0c7b6c989466a93942def1f84baf36ddfcd60c83 # frozen: v0.15.14
44
hooks:
55
- id: ruff-check
66
args: [--fix, --exit-non-zero-on-fix]
77
- id: ruff-format
88

99
- repo: https://github.com/pre-commit/pre-commit-hooks
10-
rev: v6.0.0
10+
rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # frozen: v6.0.0
1111
hooks:
1212
- id: check-added-large-files
1313
- id: check-case-conflict
@@ -20,12 +20,12 @@ repos:
2020
- id: trailing-whitespace
2121

2222
- repo: https://github.com/python-jsonschema/check-jsonschema
23-
rev: 0.37.1
23+
rev: 943377262562a12b57292fc98fabd7dbf81451fe # frozen: 0.37.2
2424
hooks:
2525
- id: check-github-workflows
2626

2727
- repo: https://github.com/rhysd/actionlint
28-
rev: v1.7.12
28+
rev: 914e7df21a07ef503a81201c76d2b11c789d3fca # frozen: v1.7.12
2929
hooks:
3030
- id: actionlint
3131

@@ -35,16 +35,22 @@ repos:
3535
- id: check-useless-excludes
3636

3737
- repo: https://github.com/pre-commit/mirrors-mypy
38-
rev: v1.20.0
38+
rev: d2823d321df3af8f878f7ee3414dc94d037145b9 # frozen: v2.1.0
3939
hooks:
4040
- id: mypy
4141
additional_dependencies: [types-docutils, types-polib>=1.2.0.20250114, types-requests]
4242

4343
- repo: https://github.com/francescorubbo/deptry-pre-commit
44-
rev: v0.25.1
44+
rev: 14b9099e8ca0e47a3ee8685e951ee66254a9846f # frozen: v0.25.1
4545
hooks:
4646
- id: deptry
4747
args: [".", "--per-rule-ignores", "DEP002=python-docs-theme", "--package-module-name-map", "gitpython=git,sphinx-lint=sphinxlint"]
4848

49+
- repo: https://github.com/djlint/djLint
50+
rev: 9112cb64851c95a7802358af285d21ad8b7f6437 # frozen: v1.36.4
51+
hooks:
52+
- id: djlint-reformat-jinja
53+
- id: djlint-jinja
54+
4955
ci:
5056
autoupdate_schedule: quarterly

djlint.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ignore="J018"
2+
indent=2

0 commit comments

Comments
 (0)