AI-news/.github/workflows/daily-news.yml
2026-04-17 21:58:37 +09:00

60 lines
1.8 KiB
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

name: Daily AI News
on:
workflow_dispatch:
inputs:
use_sample_data:
description: 'fixtures/sample-tweets.json を使って動作確認するX連携なし'
type: boolean
default: false
schedule:
- cron: '30 22 * * *' # 毎日 07:30 JST
permissions:
contents: read
concurrency:
group: daily-news
cancel-in-progress: false
jobs:
run:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
with:
node-version-file: '.nvmrc'
cache: 'npm'
- run: npm ci
- run: npm start
env:
USE_SAMPLE_DATA: ${{ inputs.use_sample_data }}
X_CONSUMER_KEY: ${{ secrets.X_CONSUMER_KEY }}
X_CONSUMER_SECRET: ${{ secrets.X_CONSUMER_SECRET }}
X_ACCESS_TOKEN: ${{ secrets.X_ACCESS_TOKEN }}
X_ACCESS_TOKEN_SECRET: ${{ secrets.X_ACCESS_TOKEN_SECRET }}
JINA_API_KEY: ${{ secrets.JINA_API_KEY }}
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL }}
- name: Notify failure to Slack
if: failure()
run: |
curl -X POST "https://slack.com/api/chat.postMessage" \
-H "Authorization: Bearer $SLACK_BOT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"channel": "'"${SLACK_CHANNEL}"'",
"text": ":x: *AIニュース エラー発生*\nワークフロー実行: <'"${FAILED_RUN_URL}"'|詳細を確認>"
}'
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL }}
FAILED_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}