Danish News Bot - Scheduled #1917
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: Danish News Bot - Scheduled | |
| on: | |
| schedule: | |
| # Adjust schedule as you like (UTC) | |
| - cron: '0 6 * * *' # 08:00 Denmark — утренние новости | |
| - cron: '0 8 * * *' # 10:00 Denmark — утренний дополнительный | |
| - cron: '0 11 * * *' # 13:00 Denmark — обеденный выпуск | |
| - cron: '0 15 * * *' # 17:00 Denmark — конец рабочего дня | |
| - cron: '0 19 * * *' # 21:00 Denmark — вечерний прайм | |
| workflow_dispatch: { } | |
| jobs: | |
| run-bot: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| permissions: | |
| contents: read # Read-only mode - bot only writes to database | |
| env: | |
| # PostgreSQL Database - КРИТИЧЕСКИ ВАЖНО для предотвращения дубликатов! | |
| DATABASE_URL: ${{ secrets.DATABASE_URL }} | |
| USE_POSTGRES: 'true' | |
| # Cache settings (fallback if PostgreSQL fails) | |
| CACHE_FILE_PATH: sent_news.json | |
| CACHE_TTL_HOURS: 48 | |
| # Bot configuration — publish limit defaults to 1 per run (configurable via PUBLISH_LIMIT) | |
| MAX_GEMINI_REQUESTS: 10 | |
| BOT_MODE: single | |
| SCRAPE_CONCURRENCY: 1 | |
| # Feature flags (NEW) | |
| ENABLE_THREAD_MODE: 'false' | |
| ENABLE_INLINE_BUTTONS: 'true' | |
| INLINE_BUTTON_MODE: 'url' | |
| ENABLE_IMPORTANCE_LINE: 'true' | |
| ENABLE_VOCAB_POST: 'false' | |
| VOCAB_WORDS_PER_DAY: 5 | |
| # Website generation (DISABLED - site builds from Supabase) | |
| ENABLE_WEBSITE: 'false' | |
| WEBSITE_CONTENT_DIR: 'website/content' | |
| # API Keys and Tokens | |
| TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }} | |
| TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }} | |
| GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }} | |
| GEMINI_API_KEY_2: ${{ secrets.GEMINI_API_KEY_2 }} | |
| GEMINI_API_KEY_3: ${{ secrets.GEMINI_API_KEY_3 }} | |
| GEMINI_MODEL: gemini-2.5-flash-lite | |
| GROQ_API_KEY: ${{ secrets.GROQ_API_KEY }} | |
| AI_PROVIDERS: "gemini,groq" | |
| COHERE_API_KEY: ${{ secrets.COHERE_API_KEY }} | |
| MISTRALAI_API_KEY: ${{ secrets.MISTRALAI_API_KEY }} | |
| AI_REQUEST_DELAY_SECONDS: '8' | |
| MIN_KEYWORD_SCORE: '6' | |
| # Supabase (for website archive) - AUTO-ENABLED when credentials present | |
| # Bot saves all news here, website pulls from this database | |
| SUPABASE_URL: ${{ secrets.SUPABASE_URL }} | |
| SUPABASE_SERVICE_KEY: ${{ secrets.SUPABASE_SERVICE_KEY }} | |
| # Go settings | |
| GO111MODULE: 'on' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.26.x' | |
| cache: true | |
| - name: Go env (debug) | |
| run: | | |
| go version | |
| go env GOMOD GOWORK GO111MODULE GOPATH GOTOOLCHAIN | |
| pwd | |
| ls -la | |
| # Оставляем файловый кеш как fallback, но теперь PostgreSQL - основной источник | |
| - name: Restore sent_news.json cache (fallback) | |
| id: cache-sent | |
| uses: actions/cache@v4 | |
| continue-on-error: true | |
| with: | |
| path: sent_news.json | |
| key: sent-news-${{ runner.os }}-${{ github.ref_name }}-${{ github.run_id }} | |
| restore-keys: | | |
| sent-news-${{ runner.os }}-${{ github.ref_name }}- | |
| sent-news-${{ runner.os }}- | |
| sent-news- | |
| - name: Show restored cache file (if any) | |
| run: | | |
| echo "Workspace: $PWD" | |
| ls -la | |
| echo "--- sent_news.json (restored) ---" | |
| test -f sent_news.json && cat sent_news.json || echo "No previous cache" | |
| - name: Prepare deps and bin dir | |
| run: | | |
| go mod download | |
| mkdir -p bin | |
| working-directory: ${{ github.workspace }} | |
| - name: Build | |
| run: | | |
| go build -o bin/dknews ./cmd/dknews | |
| working-directory: ${{ github.workspace }} | |
| - name: Run bot | |
| run: | | |
| echo "🚀 Starting Danish News Bot..." | |
| echo "Database mode: PostgreSQL (primary) + File cache (fallback)" | |
| ./bin/dknews | tee run.log | |
| working-directory: ${{ github.workspace }} | |
| # Website posts are now generated on-the-fly during site deployment | |
| # No git commits needed - bot only saves to Supabase database | |
| - name: Show resulting cache file | |
| run: | | |
| echo "--- sent_news.json (after run) ---" | |
| test -f sent_news.json && cat sent_news.json || echo "Cache file not created (using PostgreSQL)" | |
| working-directory: ${{ github.workspace }} | |
| - name: Upload run log (optional) | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: run-log-${{ github.run_number }} | |
| path: run.log | |
| if-no-files-found: ignore | |
| - name: Upload sent_news.json as artifact (fallback) | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: sent-news-cache-${{ github.run_number }} | |
| path: sent_news.json | |
| if-no-files-found: warn |