From 45f9cd45b04381ad5574879e62d348119372433a Mon Sep 17 00:00:00 2001 From: iceiix <43691553+iceiix@users.noreply.github.com> Date: Sun, 6 Mar 2022 18:25:27 -0800 Subject: [PATCH] GitHub Actions: clippy interaction fix for Win/Mac (#671) --- .github/workflows/build.yaml | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 549edeb..ca8cc02 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -66,11 +66,22 @@ jobs: - name: Build binary run: | cargo build --verbose --release - - name: Run clippy - uses: actions-rs/clippy-check@v1.0.7 + - 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: - token: ${{ secrets.GITHUB_TOKEN }} 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 - name: Check formatting run: cargo fmt --all -- --check - name: Upload binary @@ -103,11 +114,22 @@ jobs: chmod a+x target/release/stevenarella env: MACOSX_DEPLOYMENT_TARGET: 10.14 - - name: Run clippy - uses: actions-rs/clippy-check@v1.0.7 + - 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: - token: ${{ secrets.GITHUB_TOKEN }} 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 - name: Check formatting run: cargo fmt --all -- --check - name: Package binary