CSV scheduled update #305
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: CSV scheduled update | |
on: | |
schedule: | |
- cron: '0 15 * * *' | |
workflow_dispatch: | |
jobs: | |
update: | |
environment: actions | |
runs-on: ubuntu-latest | |
permissions: write-all | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: [3.8] | |
env: | |
TZ: Asia/Tokyo | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install -U pip | |
pip install -r tools/python/requirements.txt | |
- name: Synchronize the csv file with an up-to-date one | |
run: | | |
python ./tools/python/download.py ./tools/csv | |
python ./tools/python/csv-json.py "./tools/csv/kdb-$(date +%Y%m%d).csv" ./tools/python/list.txt ./src | |
- name: Get current date | |
id: date | |
run: echo "::set-output name=date::$(date +'%Y-%m-%d')" | |
- name: Create Pull Request | |
id: cpr | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
title: Sceduled update of syllabus data (${{ steps.date.outputs.date }}) | |
branch: update_${{ steps.date.outputs.date }} | |
author: GitHub Action <action@github.com> | |
committer: GitHub Action <action@github.com> | |
commit-message: | | |
update csv: ${{ steps.date.outputs.date }} | |
- name: Enable auto-merge | |
uses: peter-evans/enable-pull-request-automerge@v3 | |
with: | |
pull-request-number: ${{ steps.cpr.outputs.pull-request-number }} | |
token: ${{ secrets.GH_ADMIN_TOKEN }} | |
- name: Add label | |
run: gh pr edit ${{ steps.cpr.outputs.pull-request-number }} --add-label automated-pr | |
env: | |
GH_TOKEN: ${{ secrets.GH_ADMIN_TOKEN }} |