diff --git a/.github/workflows/link-check.yml b/.github/workflows/link-check.yml new file mode 100644 index 000000000..350e1cc1b --- /dev/null +++ b/.github/workflows/link-check.yml @@ -0,0 +1,58 @@ +name: Link Check + +on: + push: + paths: + - '**.md' + - '**.html' + pull_request: + paths: + - '**.md' + - '**.html' + schedule: + - cron: '0 8 * * 1' + +jobs: + link-check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Check relative links + run: | + set -e + echo "=== Checking relative links in Markdown files ===" + errors=0 + + for md in $(find . -name '*.md' -not -path './.git/*' -not -path './node_modules/*'); do + # Extract relative links: [text](relative/path) or [text](./relative/path) + links=$(grep -oP '\[[^\]]*\]\(\K[^)]+' "$md" | grep -v '^https\?://' | grep -v '^#' | grep -v '^mailto:' | sed 's/#.*//') + + for link in $links; do + # Remove ./ prefix if present + link=$(echo "$link" | sed 's|^\./||') + [ -z "$link" ] && continue + + # Resolve relative to the file's directory + dir=$(dirname "$md") + target="$dir/$link" + # Normalize path + target=$(echo "$target" | sed 's|/\./|/|g') + + if [ ! -e "$target" ]; then + echo " BROKEN: $md -> $link (resolved: $target)" + errors=$((errors + 1)) + else + echo " OK: $md -> $link" + fi + done + done + + echo "" + echo "=== Results ===" + if [ $errors -gt 0 ]; then + echo "FAILED: $errors broken relative link(s)" + exit 1 + else + echo "PASSED: All relative links are valid" + fi diff --git a/README.md b/README.md index 007b94adb..5de7cd33d 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ **The blockchain where old hardware outearns new hardware.** **And all hardware becomes old. It's just a matter of time.** -[![CI](https://github.com/Scottcjn/Rustchain/actions/workflows/ci.yml/badge.svg)](https://github.com/Scottcjn/Rustchain/actions/workflows/ci.yml) +[![Link Check](https://github.com/Scottcjn/Rustchain/actions/workflows/link-check.yml/badge.svg)](https://github.com/Scottcjn/Rustchain/actions/workflows/link-check.yml) [![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE) [![Stars](https://img.shields.io/github/stars/Scottcjn/Rustchain?style=flat&color=gold)](https://github.com/Scottcjn/Rustchain/stargazers) [![Nodes](https://img.shields.io/badge/Nodes-5%20Active-brightgreen)](https://rustchain.org/explorer/) @@ -422,7 +422,7 @@ Emission is a fixed 1.5 RTC per epoch and does not halve. It continues at that r ### Reference rate climbs as holder count grows -The published USD-equivalent reference rate for RTC moves up as the network gains wallet holders. **Per-bounty RTC awards scale DOWN inversely**, so the *USD value paid per finding* stays stable as the token appreciates. The live rate is always at [`/api/tokenomics`](https://rustchain.org/api/tokenomics). +The published USD-equivalent reference rate for RTC moves up as the network gains wallet holders. **Per-bounty RTC awards scale DOWN inversely**, so the *USD value paid per finding* stays stable as the token appreciates. The live rate is always at [tokenomics reference rate](docs/tokenomics_v1.md). | Holder count | Reference rate | Bounty rate scale | |--------------|----------------|-------------------|