diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index ed83b751a..517420cea 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -6,7 +6,7 @@ on: push: workflow_dispatch: workflow_run: - workflows: ["Run djlint and Ruff"] + workflows: ["Pre-commit fix"] types: - completed diff --git a/.github/workflows/pre-commit-fix.yaml b/.github/workflows/pre-commit-fix.yaml new file mode 100644 index 000000000..807496efc --- /dev/null +++ b/.github/workflows/pre-commit-fix.yaml @@ -0,0 +1,47 @@ + +name: Pre-commit fix +on: + workflow_dispatch: +permissions: + contents: write +jobs: + run-pre-commit: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + ref: ${{ github.ref_name }} + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + - name: Install pre-commit + run: | + python -m venv venv + . venv/bin/activate + pip install --upgrade pip + pip install pre-commit + - name: Run pre-commit + run: | + . venv/bin/activate + pre-commit run --all-files + continue-on-error: true + - name: Check for changes + id: check_changes + run: | + if [ -n "$(git status --porcelain)" ]; then + echo "Changes detected by pre-commit." + echo "::set-output name=changes_detected::true" + else + echo "No changes made by pre-commit." + echo "::set-output name=changes_detected::false" + fi + - name: Commit and push changes + if: steps.check_changes.outputs.changes_detected == 'true' + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add . + git commit -m "Apply pre-commit fixes" + git push origin HEAD:${{ github.ref_name }} diff --git a/.github/workflows/run-djlint.yml b/.github/workflows/run-djlint.yml index f3ae0a15b..0a36bd6e6 100644 --- a/.github/workflows/run-djlint.yml +++ b/.github/workflows/run-djlint.yml @@ -31,11 +31,16 @@ jobs: files_to_check=$(find company/templates website/templates -type f -name "*.html") djlint --reformat $files_to_check || true - - name: Run Ruff + - name: Run Ruff Fix run: | source venv/bin/activate ruff check . --fix || true + - name: Run Ruff Format + run: | + source venv/bin/activate + ruff check . --format || true + - name: Commit changes run: | git config --global user.name "github-actions[bot]" diff --git a/website/templates/monitor.html b/website/templates/monitor.html index d26e6e01f..348a5c51c 100644 --- a/website/templates/monitor.html +++ b/website/templates/monitor.html @@ -59,6 +59,9 @@

Delete unwanted da Keyword + + URL + Status @@ -66,7 +69,6 @@

Delete unwanted da {% for monitor in monitors %} - asdf
@@ -75,6 +77,9 @@

Delete unwanted da

+ +

{{ monitor.url }}

+

{{ monitor.status }}