Skip to content

Commit 1b0133d

Browse files
committed
Add Metadata Check workflow
1 parent 4af82aa commit 1b0133d

1 file changed

Lines changed: 109 additions & 0 deletions

File tree

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
name: Repository Metadata Check
2+
3+
on:
4+
schedule:
5+
# Run weekly on Mondays at 9 AM UTC
6+
- cron: '0 9 * * 1'
7+
workflow_dispatch: # Allow manual trigger
8+
9+
jobs:
10+
check-metadata:
11+
name: Check Repository Metadata
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v3
17+
18+
- name: Setup GitHub CLI
19+
run: |
20+
echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token
21+
22+
- name: Check repository metadata
23+
run: |
24+
echo "=== Repository Metadata Check ==="
25+
26+
# Get repository info
27+
REPO_INFO=$(gh api repos/${{ github.repository }})
28+
29+
# Check description
30+
DESCRIPTION=$(echo "$REPO_INFO" | jq -r '.description // ""')
31+
if [ -z "$DESCRIPTION" ]; then
32+
echo "❌ Missing repository description"
33+
echo "::warning::Repository is missing a description. Add one in Settings."
34+
else
35+
echo "✅ Repository has description: $DESCRIPTION"
36+
fi
37+
38+
# Check topics
39+
TOPICS=$(echo "$REPO_INFO" | jq -r '.topics // [] | length')
40+
if [ "$TOPICS" -eq 0 ]; then
41+
echo "❌ No repository topics/tags"
42+
echo "::warning::Repository has no topics. Add relevant topics in Settings."
43+
else
44+
echo "✅ Repository has $TOPICS topics"
45+
fi
46+
47+
# Check homepage URL
48+
HOMEPAGE=$(echo "$REPO_INFO" | jq -r '.homepage // ""')
49+
if [ -z "$HOMEPAGE" ]; then
50+
echo "ℹ️ No homepage URL set (optional)"
51+
else
52+
echo "✅ Homepage URL: $HOMEPAGE"
53+
fi
54+
55+
# Create issue if metadata is incomplete
56+
if [ -z "$DESCRIPTION" ] || [ "$TOPICS" -eq 0 ]; then
57+
# Check if issue already exists
58+
EXISTING_ISSUE=$(gh issue list --label "documentation" --label "automated" --state open --json number --jq '.[0].number // 0')
59+
60+
if [ "$EXISTING_ISSUE" -eq 0 ]; then
61+
ISSUE_BODY="This automated check found incomplete repository metadata:
62+
63+
"
64+
if [ -z "$DESCRIPTION" ]; then
65+
ISSUE_BODY="${ISSUE_BODY}### Missing Description
66+
Please add a clear, concise description to help users understand this repository's purpose.
67+
68+
**How to fix:**
69+
1. Go to Settings → Edit repository details
70+
2. Add a description (50-100 characters)
71+
3. Save changes
72+
73+
"
74+
fi
75+
76+
if [ "$TOPICS" -eq 0 ]; then
77+
ISSUE_BODY="${ISSUE_BODY}### Missing Topics/Tags
78+
Topics help users discover your repository. Please add 3-5 relevant topics.
79+
80+
**How to fix:**
81+
1. Go to the repository main page
82+
2. Click the gear icon next to 'About'
83+
3. Add relevant topics (e.g., language, framework, purpose)
84+
4. Save changes
85+
86+
**Suggested topics based on common patterns:**
87+
- Programming language (e.g., \`typescript\`, \`python\`, \`javascript\`)
88+
- Framework/library (e.g., \`react\`, \`nodejs\`, \`django\`)
89+
- Purpose (e.g., \`api\`, \`cli-tool\`, \`web-app\`)
90+
- Organization-specific (e.g., \`chittyapps\`, \`civic-tech\`)
91+
"
92+
fi
93+
94+
ISSUE_BODY="${ISSUE_BODY}
95+
---
96+
*This issue was automatically created by the Repository Metadata Check workflow.*"
97+
98+
gh issue create \
99+
--title "📋 Incomplete Repository Metadata" \
100+
--body "$ISSUE_BODY" \
101+
--label "documentation" \
102+
--label "automated" \
103+
--label "good first issue"
104+
105+
echo "📋 Created issue for incomplete metadata"
106+
else
107+
echo "ℹ️ Issue #$EXISTING_ISSUE already exists for metadata updates"
108+
fi
109+
fi

0 commit comments

Comments
 (0)