fix(clippy): allow unprivileged runs of clippy (#3558)

This commit is contained in:
Gustavo Valverde 2022-02-16 11:15:19 -04:00 committed by GitHub
parent f6b0dc74ac
commit 943a38a0d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 21 additions and 2 deletions

View File

@ -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