Skip to content

add inlines_to_plain_string #33

add inlines_to_plain_string

add inlines_to_plain_string #33

Workflow file for this run

name: Coverage
on:
push:
branches: [ "main" ]
jobs:
coverage:
runs-on: ubuntu-latest
environment: Code Coverage Badge
env:
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@v4
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Generate code coverage
run: |
percent_coverage="$(cargo llvm-cov --json | jq '.data[].totals.lines.percent')"
printf '::notice title=Coverage (lines %%)::%s' "$percent_coverage"
echo "LINES_PERCENT=$percent_coverage" >> "$GITHUB_ENV"
- name: Upload to gist
run: ./scripts/percent_to_shields_gist coverage "$LINES_PERCENT"
env:
GIST_URL: ${{ vars.COVERAGE_GIST_URL }}
GH_TOKEN: ${{ secrets.API_TOKEN }}
- name: Count TODOs
run: |
set -euo pipefail
todos_count="$(
git ls-tree -r --name-only HEAD |
grep --fixed-string -v .github/workflows/coverage.yml |
grep --fixed-string -v README.md |
(xargs grep todo -i -o || true) |
wc -l
)"
if [ "$todos_count" -eq 0 ]; then
color=green
else
color=orange
fi
json_text="$(echo '{}' |
jq -c '{schemaVersion: 1, label: $badge_label, color: $color, message: $message}' \
--arg badge_label "☑ Pending TODOs" --arg color "$color" --arg message "$todos_count")"
percent_coverage="$(cargo llvm-cov --json | jq '.data[].totals.lines.percent')"
printf '::notice title=TODOs Count::%s' "$todos_count"
gh gist edit "$GIST_URL" <(echo "$json_text")
env:
GIST_URL: ${{ vars.TODOS_GIST_URL }}
GH_TOKEN: ${{ secrets.API_TOKEN }}