UpdateMyTIL #517
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: UpdateMyTIL | |
on: | |
# 手動でもWorkflowを利用できるようにしておく | |
workflow_dispatch: | |
schedule: | |
# JSTで8:45に1週間に1回実行 | |
- cron: "45 23 * * 0" | |
jobs: | |
output_study_history: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.10" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
- name: Run index.py | |
run: | | |
python index.py | |
- name: Commit and Push diff | |
env: | |
# コマンドを実行するための環境変数をセット | |
GIT_USER: ${{ secrets.GIT_USER }} | |
GIT_MAIL: ${{ secrets.GIT_MAIL }} | |
run: | | |
# git remote set-url origin https://github.com/${GIT_USER}/til | |
git config --global user.name "${GIT_USER}" | |
git config --global user.email "${GIT_MAIL}" | |
if (git diff --shortstat | grep '[0-9]'); then \ | |
git add .; \ | |
git commit -m 'Updated TIL repository regularly!!'; \ | |
git push origin HEAD; \ | |
fi |