Get Daily #331
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
# run daily | |
name: Get Daily | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 0,13 * * *" | |
env: | |
GITHUB_NAME: chenzaichun | |
GITHUB_EMAIL: chenzaichun@gmail.com | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: My GitHub Status | |
uses: yihong0618/github-readme-stats@main | |
# with: | |
# TELEGRAM_TOKEN: ${{ secrets.TELE_TOKEN }} | |
# TELEGRAM_CHAT_ID: ${{ secrets.TELE_CHAT_ID }} | |
- name: Set up Python | |
uses: actions/setup-python@v1 | |
with: | |
python-version: 3.7 | |
- name: Configure pip cache | |
uses: actions/cache@v1 | |
id: pip-cache | |
with: | |
path: venv | |
key: pip-1-${{ hashFiles('**/requirements.txt') }} | |
restore-keys: | | |
pip- | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m venv venv | |
source venv/bin/activate | |
pip install -r requirements.txt | |
if: steps.pip-cache.outputs.cache-hit != 'true' | |
- name: Generate new md | |
run: | | |
source venv/bin/activate | |
python get_daily.py ${{ secrets.G_T }} ${{ github.repository }} | |
# Fix for the unsafe repo error: https://github.com/repo-sync/pull-request/issues/84 | |
- name: Run safe dir | |
run: | | |
git config --global --add safe.directory /github/workspace | |
- name: Push README | |
uses: chenzaichun/commit@master | |
with: | |
github-token: ${{ secrets.G_T }} | |
commit-message: "Refresh README (2022 NUM Daily)" | |
files: README.md | |
rebase: "true" | |
name: ${{ env.GITHUB_NAME }} | |
email: ${{ env.GITHUB_EMAIL }} |