summary refs log tree commit diff
path: root/.github
diff options
context:
space:
mode:
authorErik Johnston <erikj@matrix.org>2023-11-29 14:07:32 +0000
committerGitHub <noreply@github.com>2023-11-29 14:07:32 +0000
commit19dac974808dce222ffdb2e8a2b380fb0856378c (patch)
tree6ef5dd065a4240529e3ee659a5e5b2ff71d31ce0 /.github
parentSpeed up pruning of `user_ips` table (#16667) (diff)
downloadsynapse-19dac974808dce222ffdb2e8a2b380fb0856378c.tar.xz
Add a workflow to try and automatically fixup a PR (#16704)
Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
Diffstat (limited to '.github')
-rw-r--r--.github/workflows/fix_lint.yaml52
1 files changed, 52 insertions, 0 deletions
diff --git a/.github/workflows/fix_lint.yaml b/.github/workflows/fix_lint.yaml
new file mode 100644
index 0000000000..f1e35fcd99
--- /dev/null
+++ b/.github/workflows/fix_lint.yaml
@@ -0,0 +1,52 @@
+# A helper workflow to automatically fixup any linting errors on a PR. Must be
+# triggered manually.
+
+name: Attempt to automatically fix linting errors
+
+on:
+  workflow_dispatch:
+
+jobs:
+  fixup:
+    name: Fix up
+    runs-on: ubuntu-latest
+
+    steps:
+      - name: Checkout repository
+        uses: actions/checkout@v4
+
+      - name: Install Rust
+        uses: dtolnay/rust-toolchain@master
+        with:
+          # We use nightly so that `fmt` correctly groups together imports, and
+          # clippy correctly fixes up the benchmarks.
+          toolchain: nightly-2022-12-01
+          components: rustfmt
+      - uses: Swatinem/rust-cache@v2
+
+      - name: Setup Poetry
+        uses: matrix-org/setup-python-poetry@v1
+        with:
+          install-project: "false"
+
+      - name: Import order (isort)
+        continue-on-error: true
+        run: poetry run isort .
+
+      - name: Code style (black)
+        continue-on-error: true
+        run: poetry run black .
+
+      - name: Semantic checks (ruff)
+        continue-on-error: true
+        run: poetry run ruff --fix .
+
+      - run: cargo clippy --all-features --fix -- -D warnings
+        continue-on-error: true
+
+      - run: cargo fmt
+        continue-on-error: true
+
+      - uses: stefanzweifel/git-auto-commit-action@v5
+        with:
+            commit_message: "Attempt to fix linting"