Repository: mbrubeck/agate (language: rust)

Issue:
clippy action fails on PRs (specifically worse with dependabot)
https://github.com/actions-rs/clippy-check#limitations

And it's specifically worse with dependabot
https://github.com/actions-rs/clippy-check/issues/2#issuecomment-807852653

solutions could be to remove it or ignore when PRs are from dependabot

another option is to check for write access before running the annotation action vs manual clippy

```
      - name: Check workflow permissions
        id: check_permissions
        uses: scherermichael-oss/action-has-permission@1.0.6
        with:
          required-permission: write
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      - name: Run clippy action to produce annotations
        uses: actions-rs/clippy-check@v1
        if: steps.check_permissions.outputs.has-permission
        with:
          args: --all-targets -- -D warnings
          token: ${{ secrets.GITHUB_TOKEN }}
      - name: Run clippy manually without annotations
        if: ${{ !steps.check_permissions.outputs.has-permission }}
        run: cargo clippy --all-targets -- -D warnings
```


Discussion / hints:

Fix patch:
diff --git a/.github/workflows/cargo-audit.yml b/.github/workflows/cargo-audit.yml
index 025976e..b75cae7 100644
--- a/.github/workflows/cargo-audit.yml
+++ b/.github/workflows/cargo-audit.yml
@@ -12,7 +12,7 @@ jobs:
   cargo-audit:
     runs-on: ubuntu-latest
     steps:
-      - uses: actions/checkout@v1
+      - uses: actions/checkout@v2
       - uses: actions-rs/audit-check@v1
         with:
           token: ${{ secrets.GITHUB_TOKEN }}


Test patch:
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index ed39f14..41bc3ba 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -2,19 +2,31 @@ name: Tests
 
 on:
   push:
+    branches-ignore:
+      - dependabot/*
   pull_request:
     branches:
       - master
 
 jobs:
-  build:
+  clippy:
     runs-on: ubuntu-latest
     steps:
       - uses: actions/checkout@v2
-      - uses: actions-rs/clippy-check@v1
+      - name: Run clippy action to produce annotations
+        # Don't run on dependabot PRs
+        # https://github.com/actions-rs/clippy-check/issues/2#issuecomment-807852653
+        if: github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]'
+        uses: actions-rs/clippy-check@v1
         with:
           token: ${{ secrets.GITHUB_TOKEN }}
           args: --all-features
+      - name: Run clippy manually without annotations
+        if: github.event.pull_request.head.repo.full_name != github.repository || github.actor == 'dependabot[bot]'
+        uses: actions-rs/cargo@v1
+        with:
+          command: clippy
+          args: --all-targets -- -D warnings
   formatting:
     runs-on: ubuntu-latest
     steps:
diff --git a/tests/tests.rs b/tests/tests.rs
index 330d41f..415afdb 100644
--- a/tests/tests.rs
+++ b/tests/tests.rs
@@ -440,7 +440,7 @@ fn directory_traversal_regression() {
     absolute
         .path_segments_mut()
         .unwrap()
-        .push(&env!("CARGO_MANIFEST_DIR")) // separators will be percent-encoded
+        .push(env!("CARGO_MANIFEST_DIR")) // separators will be percent-encoded
         .push("tests")
         .push("data")
         .push("directory_traversal.gmi");
@@ -449,7 +449,7 @@ fn directory_traversal_regression() {
     relative_escape_path.push("testdir");
     relative_escape_path.push("..");
     relative_escape_path.push("..");
-    let mut relative = base.clone();
+    let mut relative = base;
     relative
         .path_segments_mut()
         .unwrap()