fix(clippy): allow unprivileged runs of clippy
@@ -28,14 +28,33 @@ jobs:
with:
persist-credentials: false
- - name: Run 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.0.7
+ if: ${{ steps.check_permissions.outputs.has-permission }}
with:
# GitHub displays the clippy job and its results as separate entries
name: Clippy (stable) Results
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features --all-targets -- -D warnings
+ - uses: actions-rs/toolchain@v1.0.1
+ if: ${{ !steps.check_permissions.outputs.has-permission }}
+ with:
+ toolchain: stable
+ override: true
+
+ - name: Run clippy manually without annotations
+ if: ${{ !steps.check_permissions.outputs.has-permission }}
+ run: cargo clippy --all-features --all-targets -- -D warnings
+
fmt:
name: Rustfmt
timeout-minutes: 30
@@ -46,7 +65,7 @@ jobs:
with:
persist-credentials: false
- - uses: actions-rs/toolchain@v1
+ - uses: actions-rs/toolchain@v1.0.1
with:
toolchain: stable
components: rustfmt
