Skip to content

Commit

Permalink
fix(clippy): allow unprivileged runs of clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
CPerezz committed Feb 20, 2023
1 parent c85ab01 commit 4d0be6e
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 20 deletions.
41 changes: 29 additions & 12 deletions .github/workflows/lints-beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,39 @@ name: Beta lints
on: push

jobs:
clippy-beta:
name: Clippy (beta)
clippy:
name: Clippy
timeout-minutes: 30
runs-on: ubuntu-latest
continue-on-error: true

steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
- uses: actions/checkout@v2
with:
components: clippy
override: false
- name: Run Clippy (beta)
uses: actions-rs/clippy-check@v1
continue-on-error: true
persist-credentials: false

- name: Check workflow permissions
id: check_permissions
uses: scherermichael-oss/[email protected]
with:
required-permission: write
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Run clippy action to produce annotations
uses: actions-rs/[email protected]
if: ${{ steps.check_permissions.outputs.has-permission }}
with:
name: Clippy (beta)
# GitHub displays the clippy job and its results as separate entries
name: Clippy (stable) Results
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features --all-targets -- -W clippy::all
args: --all-features --all-targets -- -D warnings

- uses: actions-rs/[email protected]
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
35 changes: 27 additions & 8 deletions .github/workflows/lints-stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,38 @@ on: pull_request

jobs:
clippy:
name: Clippy (1.56.1)
name: Clippy
timeout-minutes: 30
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
- uses: actions/checkout@v2
with:
components: clippy
override: false
- name: Run clippy
uses: actions-rs/clippy-check@v1
persist-credentials: false

- name: Check workflow permissions
id: check_permissions
uses: scherermichael-oss/[email protected]
with:
required-permission: write
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Run clippy action to produce annotations
uses: actions-rs/[email protected]
if: ${{ steps.check_permissions.outputs.has-permission }}
with:
name: Clippy (1.56.1)
# 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/[email protected]
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

0 comments on commit 4d0be6e

Please sign in to comment.