-
Notifications
You must be signed in to change notification settings - Fork 0
127 lines (107 loc) · 4.32 KB
/
update_citations.yml
File metadata and controls
127 lines (107 loc) · 4.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
name: Update Citations Page
on:
schedule: # execute every week on Monday at midnight
- cron: "0 0 * * 1"
workflow_dispatch: # Allow manual trigger
permissions:
contents: write
jobs:
update-citations:
name: 📚 Update Citations Page
runs-on: ubuntu-latest
steps:
- name: 📥 Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: 🐍 Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
- name: 📦 Install Python dependencies
run: |
echo "📦 Installing Python dependencies..."
pip install -r scripts/citations/requirements.txt
echo "✅ Dependencies installed"
- name: 🔍 Verify dependencies
run: |
echo "🔍 Verifying installed packages..."
python3 -c "import requests; print(f'✓ requests {requests.__version__}')"
python3 -c "import bs4; print(f'✓ beautifulsoup4 installed')"
python3 -c "import lxml; print(f'✓ lxml installed')"
echo "✅ All dependencies verified"
- name: 📚 Generate citations page
run: |
echo "📚 Generating citations page..."
echo "📊 Retrieving citations from Google Scholar..."
cd scripts/citations
python3 generate_citations_page.py
echo "✅ Citations page generated"
- name: 📊 Check if file was generated
run: |
if [ -f "about/citations.md" ]; then
echo "✅ Citations page exists"
echo "📄 File size: $(stat -f%z about/citations.md 2>/dev/null || stat -c%s about/citations.md 2>/dev/null) bytes"
echo ""
echo "📋 First 10 lines:"
head -n 10 about/citations.md
else
echo "❌ Citations page not found!"
exit 1
fi
- name: 🔧 Configure git
run: |
echo "🔧 Configuring git user..."
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
echo "✅ Git user configured"
- name: 📝 Commit and push changes
run: |
echo "🌳 Checking git status..."
git status
echo ""
echo "📚 Adding citations page..."
git add about/citations.md
# Check if there are changes to commit
if git diff --cached --quiet; then
echo "ℹ️ No changes detected in citations page"
echo "📚 Page is already up to date"
exit 0
fi
echo "✅ Changes detected, preparing commit..."
echo ""
echo "📋 Files to be committed:"
git diff --cached --name-status
echo ""
echo "📝 Committing changes..."
TIMESTAMP=$(date -u +"%Y-%m-%d %H:%M UTC")
git commit -m "📚 Update citations page" \
-m "Automated update of the citations page from Google Scholar" \
-m "Generated on: $TIMESTAMP" \
-m "" \
-m "This commit was automatically created by the Update Citations workflow."
echo "✅ Changes committed"
echo ""
echo "🚀 Pushing to repository..."
git push origin main || git push origin master
echo "✅ Changes pushed successfully"
- name: ✅ Workflow summary
if: always()
run: |
echo ""
echo "=========================================="
echo "📚 Citations Page Update Summary"
echo "=========================================="
echo ""
if [ -f "about/citations.md" ]; then
echo "✅ Citations page: Generated"
echo "📁 Location: about/citations.md"
echo "🌐 URL: https://control-toolbox.org/citations/"
else
echo "❌ Citations page: Failed to generate"
fi
echo ""
echo "🕒 Workflow completed at: $(date -u +"%Y-%m-%d %H:%M UTC")"
echo "=========================================="