Skip to content

Overhaul metadata system #8

Overhaul metadata system

Overhaul metadata system #8

Workflow file for this run

name: Metadata Check
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
check-metadata:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install dependencies
run: npm install
- name: Run metadata check
run: node scripts/check-metadata.js
- name: Upload metadata report
uses: actions/upload-artifact@v3
with:
name: metadata-report
path: metadata-report.md
- name: Check for metadata issues and post comment
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
PARTIAL=$(grep -c "⚠️ Partial metadata:" metadata-report.md || true)
NO_METADATA=$(grep -c "❌ No metadata:" metadata-report.md || true)
ERRORS=$(grep -c "🚫 Errors:" metadata-report.md || true)
if [ $PARTIAL -gt 0 ] || [ $NO_METADATA -gt 0 ] || [ $ERRORS -gt 0 ]; then
echo "Metadata issues found. Posting comment on PR."
PARTIAL_LIST=$(sed -n '/^### Partial Metadata Pages/,/^###/p' metadata-report.md | sed '$d')
NO_METADATA_LIST=$(sed -n '/^### No Metadata Pages/,/^###/p' metadata-report.md | sed '$d')
COMMENT="## Metadata Check Results\n\n"
COMMENT+="Metadata issues were found in this pull request. Please address them.\n\n"
COMMENT+="$PARTIAL_LIST\n\n"
COMMENT+="$NO_METADATA_LIST\n\n"
COMMENT+="For full details, please check the metadata-report.md artifact."
gh pr comment "${{ github.event.pull_request.number }}" --body "$COMMENT"
exit 1
else
echo "No metadata issues found."
fi