docs: reverse gas model concept page #33
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Check upstream notes | |
| on: | |
| pull_request: | |
| paths: | |
| - 'docs/**/*.md' | |
| jobs: | |
| check-upstream-notes: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Check for upstream comments in changed docs | |
| run: | | |
| base="${{ github.event.pull_request.base.sha }}" | |
| head="${{ github.event.pull_request.head.sha }}" | |
| # Get changed .md files under docs/ | |
| changed=$(git diff --name-only --diff-filter=AM "$base" "$head" -- 'docs/**/*.md') | |
| if [ -z "$changed" ]; then | |
| echo "No docs markdown files changed." | |
| exit 0 | |
| fi | |
| # Paths to skip: synced files and stubs | |
| skip_patterns=( | |
| "docs/languages/motoko/" | |
| "docs/guides/tools/migrating-from-dfx.md" | |
| ) | |
| missing=() | |
| for file in $changed; do | |
| # Skip synced files | |
| skip=false | |
| for pattern in "${skip_patterns[@]}"; do | |
| if [[ "$file" == $pattern* ]]; then | |
| skip=true | |
| break | |
| fi | |
| done | |
| if [ "$skip" = true ]; then | |
| continue | |
| fi | |
| # Skip stubs (contain "TODO: Write content") | |
| if grep -q "TODO: Write content" "$file"; then | |
| continue | |
| fi | |
| # Check for upstream comment | |
| if ! grep -q '<!-- Upstream: \(hand-written\|sync from\|informed by\)' "$file"; then | |
| missing+=("$file") | |
| fi | |
| done | |
| if [ ${#missing[@]} -gt 0 ]; then | |
| echo "::error::The following files are missing an upstream comment:" | |
| for f in "${missing[@]}"; do | |
| echo "::error file=$f::Missing <!-- Upstream: hand-written|sync from|informed by --> comment" | |
| done | |
| echo "" | |
| echo "Every non-stub docs page must include one of:" | |
| echo ' <!-- Upstream: hand-written -->' | |
| echo ' <!-- Upstream: sync from <repo> <path> -->' | |
| echo ' <!-- Upstream: informed by <repo> — <files> -->' | |
| exit 1 | |
| fi | |
| echo "All changed docs files have upstream comments." |