From d16c24b8fe23034f249616017c29d23dc002394c Mon Sep 17 00:00:00 2001 From: iceiix <43691553+iceiix@users.noreply.github.com> Date: Sat, 19 Feb 2022 16:26:17 -0800 Subject: [PATCH] GitHub Actions: manually run clippy if resource not accessible (#662) * GitHub Actions: manually run clippy if resource not accessible, https://github.com/actions-rs/clippy-check/issues/2#issuecomment-807878478 * readme: update status badge for GitHub Actions --- .github/workflows/build.yaml | 17 ++++++++++++++--- README.md | 2 +- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 2738c6e..bddd1cc 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -21,11 +21,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 diff --git a/README.md b/README.md index 6928c53..ecc8476 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Stevenarella -[![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Ficeiix%2Fstevenarella%2Fbadge%3Fref%3Dmaster&style=plastic)](https://actions-badge.atrox.dev/iceiix/stevenarella/goto?ref=master) +[![Build](https://github.com/iceiix/stevenarella/actions/workflows/build.yaml/badge.svg)](https://github.com/iceiix/stevenarella/actions/workflows/build.yaml) Multi-protocol Minecraft-compatible client written in Rust.