This repository was archived by the owner on Apr 6, 2026. It is now read-only.
Documentation Auto-Update #11
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: Documentation Auto-Update | |
| on: | |
| schedule: | |
| # Update documentation every Sunday at 22:00 UTC | |
| - cron: '0 22 * * 0' | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| update-timestamps: | |
| name: Update Last Modified Timestamps | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Update timestamps | |
| run: | | |
| #!/bin/bash | |
| set -e | |
| echo "Updating last_updated timestamps..." | |
| for file in $(find docs -name "*.md" ! -path "*/working/*"); do | |
| # Get last git commit date for this file | |
| last_commit_date=$(git log -1 --format="%ad" --date=short -- "$file" 2>/dev/null || echo "") | |
| if [[ -z "$last_commit_date" ]]; then | |
| continue | |
| fi | |
| # Check if file has front matter | |
| if ! head -n 1 "$file" | grep -q "^---$"; then | |
| continue | |
| fi | |
| # Update last_updated field | |
| if grep -q "^last_updated:" "$file"; then | |
| current_date=$(grep "^last_updated:" "$file" | cut -d':' -f2- | xargs) | |
| if [[ "$current_date" != "$last_commit_date" ]]; then | |
| sed -i "s/^last_updated:.*/last_updated: $last_commit_date/" "$file" | |
| echo "Updated: $file ($current_date -> $last_commit_date)" | |
| fi | |
| fi | |
| done | |
| - name: Create Pull Request | |
| uses: peter-evans/create-pull-request@v6 | |
| with: | |
| commit-message: 'docs: update last_modified timestamps' | |
| title: '📅 Automated documentation timestamp update' | |
| body: | | |
| This PR updates `last_updated` timestamps in documentation front matter based on git commit history. | |
| Generated with [Claude Code](https://claude.com/claude-code) | |
| Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> | |
| branch: docs/auto-update-timestamps | |
| delete-branch: true | |
| labels: documentation, automated | |
| check-outdated: | |
| name: Check for Outdated Documentation | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Find outdated docs | |
| run: | | |
| #!/bin/bash | |
| set -e | |
| echo "# Outdated Documentation Report" > outdated.md | |
| echo "" >> outdated.md | |
| echo "Generated: $(date -u +%Y-%m-%d\ %H:%M:%S\ UTC)" >> outdated.md | |
| echo "" >> outdated.md | |
| THRESHOLD_DAYS=90 | |
| CURRENT_EPOCH=$(date +%s) | |
| while IFS= read -r file; do | |
| if ! grep -q "^last_updated:" "$file"; then | |
| continue | |
| fi | |
| last_updated=$(grep "^last_updated:" "$file" | cut -d':' -f2- | xargs) | |
| last_updated_epoch=$(date -d "$last_updated" +%s 2>/dev/null || echo 0) | |
| if [[ $last_updated_epoch -eq 0 ]]; then | |
| continue | |
| fi | |
| days_old=$(( (CURRENT_EPOCH - last_updated_epoch) / 86400 )) | |
| if [[ $days_old -gt $THRESHOLD_DAYS ]]; then | |
| echo "- **$file**: Last updated $days_old days ago ($last_updated)" >> outdated.md | |
| fi | |
| done < <(find docs -name "*.md" ! -path "*/working/*") | |
| if [[ $(wc -l < outdated.md) -gt 4 ]]; then | |
| echo "" >> outdated.md | |
| echo "**Action Required**: These documents should be reviewed and updated." >> outdated.md | |
| cat outdated.md | |
| else | |
| echo "No outdated documentation found." | |
| fi | |
| - name: Create issue for outdated docs | |
| if: hashFiles('outdated.md') != '' | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const fs = require('fs'); | |
| const content = fs.readFileSync('outdated.md', 'utf8'); | |
| if (content.split('\n').length > 4) { | |
| github.rest.issues.create({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| title: '📚 Documentation review needed: outdated files detected', | |
| body: content, | |
| labels: ['documentation', 'maintenance', 'review-needed'] | |
| }); | |
| } |