cron #24
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: cron | |
on: | |
schedule: | |
- cron: "0 * * * *" | |
jobs: | |
# https://zenn.dev/snowcait/articles/903d86d668fcb7 | |
deploy: | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.3 | |
- uses: actions/checkout@v4 | |
- name: Get Composer cache directory path | |
id: composer-cache-dir-path | |
run: echo "path=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Cache Composer dependencies | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.composer-cache-dir-path.outputs.path }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Install Composer Dependencies | |
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist --no-dev | |
- name: Build JSON files | |
run: bin/console build | |
- name: Check diff | |
id: diff | |
run: | | |
git add -N . | |
git diff --name-only --exit-code | |
continue-on-error: true | |
- name: Push to gh-pages branch | |
if: steps.diff.outcome == 'failure' | |
# https://github.com/actions/checkout/issues/13#issuecomment-724415212 | |
run: | | |
set -x | |
git config user.name github-actions[bot] | |
git config user.email 41898282+github-actions[bot]@users.noreply.github.com | |
git add . | |
git commit --author="github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>" -m "Automatically committed" | |
git push |