update-news #882
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: update-news | |
on: | |
schedule: | |
# * is a special character in YAML so you have to quote this string | |
- cron: '0 0 * * *' # every midnight | |
workflow_dispatch: | |
inputs: | |
logLevel: | |
description: 'Log level' | |
required: true | |
default: 'warning' | |
permissions: | |
contents: read | |
pull-requests: write | |
jobs: | |
update-news: | |
name: update news | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
python-version: [3.7] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python using Miniconda | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
auto-update-conda: true | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
pip install --upgrade google-api-python-client google-auth-httplib2 google-auth-oauthlib | |
shell: bash -l {0} | |
- name: Download data from google drive | |
env: | |
TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
REFRESH_TOKEN: ${{ secrets.REFRESH_TOKEN }} | |
CLIENT_ID: ${{ secrets.CLIENT_ID }} | |
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} | |
FOLDER_ID: ${{ secrets.NEWS_FOLDER_ID }} | |
run: | | |
python tools/download_from_drive.py --token "$TOKEN" --refresh_token "$REFRESH_TOKEN" --client_id "$CLIENT_ID" --client_secret "$CLIENT_SECRET" --folder_id "$FOLDER_ID" --output_path "news" | |
shell: bash -l {0} | |
- name: Create Pull Request | |
id: cpr | |
uses: peter-evans/create-pull-request@v4 | |
with: | |
token: ${{ secrets.PAT }} | |
commit-message: Update news | |
committer: GitHub <[email protected]> | |
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> | |
signoff: false | |
branch: update-news | |
delete-branch: true | |
title: 'Automatic news data update' | |
body: | | |
Create PR | |
- Auto-generated PR in action | |
- Create news.json and images | |
- https://github.com/peter-evans/create-pull-request | |
labels: | | |
test | |
automated pr | |
assignees: kjones002 | |
reviewers: kjones002 | |
draft: false |