From c5dccbfe62a185cd58ddf6becb91d85335513004 Mon Sep 17 00:00:00 2001 From: Go Kudo Date: Wed, 26 Feb 2025 14:55:34 +0000 Subject: [PATCH] chore: add GitHub Pages permissions to workflow - Add pages write permission to deploy coverage reports - Add id-token write permission for GitHub Pages deployment authentication --- .github/workflows/coverage.yaml | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/.github/workflows/coverage.yaml b/.github/workflows/coverage.yaml index 67918c1..2351b04 100644 --- a/.github/workflows/coverage.yaml +++ b/.github/workflows/coverage.yaml @@ -2,6 +2,8 @@ name: Coverage permissions: contents: write pull-requests: write + pages: write + id-token: write on: push: branches: @@ -11,6 +13,9 @@ on: - opened - synchronize - reopened +concurrency: + group: "pages" + cancel-in-progress: false jobs: Linux: strategy: @@ -53,30 +58,48 @@ jobs: - name: Merge coverages run: | LCOV_FILES=$(find coverage-artifacts -name "lcov.info" -type f) - + if [ -z "$LCOV_FILES" ]; then echo "No lcov.info files found in the artifacts!" exit 1 fi - + CMD="lcov" for LCOV_FILE in $LCOV_FILES; do echo "Adding coverage file: $LCOV_FILE" CMD+=" -a $LCOV_FILE" done CMD+=" -o lcov.info" - + echo "Executing: $CMD" eval $CMD - + if [ ! -f "lcov.info" ]; then echo "Failed to generate merged lcov.info file!" exit 1 fi - + echo "Successfully merged $(echo $LCOV_FILES | wc -w) coverage files." + - name: Generate HTML report + run: | + genhtml lcov.info -o coverage - name: Report coverage uses: k1LoW/octocov-action@v1 with: github-token: ${{ secrets.GITHUB_TOKEN }} config: .github/octocov.yml + - name: Upload pages artifact + uses: actions/upload-pages-artifact@v3 + with: + path: coverage + Deploy: + needs: Coverage + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4