Daily Make and Commit #482
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: Daily Make and Commit | |
on: | |
schedule: | |
- cron: '0 21 * * *' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 1 # 只获取最近一次提交 | |
- name: Set up cache | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.cache | |
~/.local | |
key: ${{ runner.os }}-cache-${{ hashFiles('**/makefile') }} | |
restore-keys: | | |
${{ runner.os }}-cache- | |
- name: Set up environment | |
run: | | |
sudo apt-get update && sudo apt-get install -y make | |
- name: Run make | |
run: make | |
- name: Commit and push if it changed | |
run: | | |
git config --global user.email "action@github.com" | |
git config --global user.name "GitHub Action" | |
if [ -n "$(git status --porcelain)" ]; then | |
git add . | |
git commit -m 'Automated update' | |
git push | |
fi |