Content Aggregator #4
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: Content Aggregator | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 8 * * *' # Daily at 08:00 UTC | |
jobs: | |
summarize: | |
runs-on: ubuntu-latest | |
timeout-minutes: 120 # 2 hour timeout | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Install system dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y \ | |
python3-dev \ | |
libxml2-dev \ | |
libxslt-dev \ | |
chromium-chromedriver \ | |
jq | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Run summarizer | |
env: | |
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }} | |
GEMINI_MODEL_SUMMARIZE: ${{ secrets.GEMINI_MODEL_SUMMARIZE }} | |
GEMINI_MODEL_DATE_EXTRACT: ${{ secrets.GEMINI_MODEL_DATE_EXTRACT }} | |
DEBUG: "false" | |
ARTICLES_LIMIT: "5" | |
run: python main.py | |
- name: Upload output files | |
uses: actions/upload-artifact@v4 | |
with: | |
name: summaries | |
path: | | |
outputs/*.json | |
outputs/*.txt | |
retention-days: 1 | |
- name: Create GitHub Issue | |
if: success() # Only run if previous steps succeeded | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
# Combine output files into markdown | |
echo "# 📰 Daily Content Summary - $(date +'%Y-%m-%d %H:%M UTC')" > issue_body.md | |
echo "### Articles Processed" >> issue_body.md | |
jq -r '.[] | "- [📄](\(.url)) \(.summary)\n _Tags: \(.tags | join(", "))_ \n"' outputs/*.json >> issue_body.md 2>/dev/null || echo "No articles processed today" >> issue_body.md | |
printf "\n### Executive Summary\n" >> issue_body.md | |
echo "$(cat outputs/*_summary.txt 2>/dev/null || echo 'No summary generated')\n" >> issue_body.md | |
echo "---**Automated Summary**" >> issue_body.md | |
cat issue_body.md | |
# Create issue using GitHub CLI | |
gh issue create \ | |
--title "Daily Content Summary $(date +'%Y-%m-%d')" \ | |
--body-file issue_body.md \ | |
--label automated |