Skip to content

Remove invalid character from CONTRIBUTING.md #196

Remove invalid character from CONTRIBUTING.md

Remove invalid character from CONTRIBUTING.md #196

Workflow file for this run

name: "3. Code Coverage"
permissions:
contents: write
pull-requests: write
issues: write
on:
push:
branches: ["main", "feature/*"]
paths-ignore:
- "**/README.md"
- "coverage-badge.svg" # avoid loops after merge
pull_request:
branches: ["main"]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
fetch-depth: 0
persist-credentials: false
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Install ReportGenerator tool
run: dotnet tool install --global dotnet-reportgenerator-globaltool
- name: Restore dependencies
run: dotnet restore
- name: Build the solution
run: dotnet build --no-restore
- name: Run tests and collect code coverage
run: dotnet test --no-build --collect:"XPlat Code Coverage"
- name: Generate code coverage report
run: reportgenerator -reports:"**/coverage.cobertura.xml" -targetdir:"coverage" -reporttypes:"HtmlInline_AzurePipelines;Badges"
- name: Upload coverage report zip
uses: actions/upload-artifact@v4
with:
name: code-coverage-report
path: coverage
- name: Prepare badge for repo root (only on main)
if: github.ref == 'refs/heads/main'
run: cp coverage/badge_linecoverage.svg ./coverage-badge.svg
# Compare against current main and only proceed if the badge changed
- name: Detect badge change (only on main)
if: github.ref == 'refs/heads/main'
id: badge
shell: bash
run: |
set -e
if [ ! -f coverage-badge.svg ]; then
echo "exists=false" >> $GITHUB_OUTPUT
exit 0
fi
# Get current version from main (if it exists)
if git cat-file -e origin/main:coverage-badge.svg 2>/dev/null; then
git show origin/main:coverage-badge.svg > /tmp/old-badge.svg
if cmp -s coverage-badge.svg /tmp/old-badge.svg; then
echo "exists=true" >> $GITHUB_OUTPUT
echo "changed=false" >> $GITHUB_OUTPUT
exit 0
fi
fi
echo "exists=true" >> $GITHUB_OUTPUT
echo "changed=true" >> $GITHUB_OUTPUT
- name: Open / update PR with coverage badge (only when changed)
if: github.ref == 'refs/heads/main' && steps.badge.outputs.exists == 'true' && steps.badge.outputs.changed == 'true'
id: cpr
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: ci/update-coverage-badge
base: main
title: "Update coverage badge"
commit-message: "Update coverage badge"
body: "Automated update of coverage-badge.svg"
add-paths: |
coverage-badge.svg
labels: |
ci
automated
- name: Report CPR result
if: github.ref == 'refs/heads/main'
run: |
echo "exists=${{ steps.badge.outputs.exists }}"
echo "changed=${{ steps.badge.outputs.changed }}"
echo "result=${{ steps.cpr.outputs.result }}"
echo "pr=${{ steps.cpr.outputs['pull-request-url'] || 'n/a' }}"