Skip to content

Commit 76adcba

Browse files
committed
ci: update .github/workflows/cron.yml
1 parent 09ef8e7 commit 76adcba

1 file changed

Lines changed: 21 additions & 8 deletions

File tree

.github/workflows/cron.yml

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
workflow_dispatch:
77

88
concurrency:
9-
group: cron-deploy-v2
9+
group: cron-${{ github.ref }}
1010
cancel-in-progress: false
1111

1212
permissions:
@@ -19,12 +19,26 @@ jobs:
1919

2020
steps:
2121
- name: Setup PHP
22-
uses: shivammathur/setup-php@v2
22+
uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f
2323
with:
2424
php-version: '8.4'
2525

2626
- name: Checkout Code
27-
uses: actions/checkout@v6.0.2
27+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
28+
with:
29+
fetch-depth: 0
30+
31+
- name: Get Composer cache directory
32+
id: composer-cache
33+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
34+
35+
- name: Cache Composer dependencies
36+
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7
37+
with:
38+
path: ${{ steps.composer-cache.outputs.dir }}
39+
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
40+
restore-keys: |
41+
${{ runner.os }}-php-
2842
2943
- name: Install base dependencies (without scraper)
3044
run: |
@@ -45,19 +59,18 @@ jobs:
4559

4660
- name: Deploy JSON for scraper v2
4761
run: |
48-
set -e
4962
git config --global user.name "github-actions[bot]"
5063
git config --global user.email "github-actions[bot]@users.noreply.github.com"
5164
FILES=$(
5265
{
53-
git ls-files -m -- 'docs/v2' | grep '\.json$' || true
54-
git diff --cached --name-only --diff-filter=AM -- 'docs/v2' | grep '\.json$' || true
55-
git ls-files --others --exclude-standard -- 'docs/v2' | grep '\.json$' || true
66+
git ls-files -m -- 'docs/v2' | grep '\.json$'
67+
git diff --cached --name-only --diff-filter=AM -- 'docs/v2' | grep '\.json$'
68+
git ls-files --others --exclude-standard -- 'docs/v2' | grep '\.json$'
5669
} | sort -u
5770
)
5871
if [ -n "$FILES" ]; then
5972
git add $FILES
60-
git commit -m "chore: deploy JSON files to docs/v2 [skip ci]" || true
73+
git commit -m "chore: deploy JSON files to docs/v2 [skip ci]" || exit 0
6174
git pull --rebase --autostash
6275
git push origin HEAD
6376
else

0 commit comments

Comments
 (0)