GitHub_Actions(news) #753
This file contains 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: GitHub_Actions(news) | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 7 * * *" | |
env: #環境変数から文字列(パスワードなど)を取得 | |
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} | |
ACCESS_TOKEN_SECRET: ${{ secrets.ACCESS_TOKEN_SECRET }} | |
CONSUMER_KEY: ${{ secrets.CONSUMER_KEY }} | |
CONSUMER_SECRET: ${{ secrets.CONSUMER_SECRET }} | |
IMGUR: ${{ secrets.IMGUR }} | |
LINE_NOTIFY: ${{ secrets.LINE_NOTIFY }} | |
MISSKEY: ${{ secrets.MISSKEY }} | |
JSON: ${{ secrets.JSON }} | |
SHEET_ID: ${{ secrets.SHEET_ID }} | |
WEBHOOK: ${{ secrets.WEBHOOK_NEWS }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
TZ: "Asia/Tokyo" | |
concurrency: # 同時にworkflowが実行されたらキャンセル | |
group: ${{ github.workflow }}-${{ github.ref }} | |
jobs: | |
python: | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.x" | |
architecture: "x64" | |
- name: Run python | |
run: | | |
echo "::group::pip" | |
pip install --upgrade pip | |
pip install -r ./requirements.txt | |
echo "::endgroup::" | |
python -B ./news/news.py | |
- name: Notify discord when job failed | |
if: ${{ failure() }} | |
uses: sarisia/actions-status-discord@v1 | |
env: | |
DISCORD_WEBHOOK: ${{ secrets.WEBHOOK_ERROR }} | |
with: | |
status: ${{ job.status }} |