From ef40387bd57440ccc9dcacf72dce8ff98bf8261d Mon Sep 17 00:00:00 2001 From: Ruijian Zhang Date: Tue, 29 Oct 2024 21:42:38 +0800 Subject: [PATCH] update action --- .github/workflows/main.yaml | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index fe312d1..685eba3 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -12,7 +12,15 @@ jobs: - name: Checkout code uses: actions/checkout@v2 with: - fetch-depth: 0 + fetch-depth: 1 # 只获取最近一次提交 + + - name: Set up cache + uses: actions/cache@v2 + with: + path: ~/.cache + key: ${{ runner.os }}-cache-${{ hashFiles('**/makefile') }} + restore-keys: | + ${{ runner.os }}-cache- - name: Set up environment run: | @@ -26,5 +34,8 @@ jobs: run: | git config --global user.email "action@github.com" git config --global user.name "GitHub Action" - git diff --quiet && git diff --staged --quiet || (git add . ; git commit -m 'Automated update') - git push + if [ -n "$(git status --porcelain)" ]; then + git add . + git commit -m 'Automated update' + git push + fi \ No newline at end of file