Fetch News #33
This file contains hidden or 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: Fetch News | |
on: | |
schedule: | |
# 毎朝 9:00 JST | |
- cron: '0 0 * * *' | |
workflow_dispatch: | |
jobs: | |
fetch: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: .ruby-version | |
bundler-cache: true | |
- name: Install dependencies | |
run: bundle install --jobs 4 --retry 3 | |
- name: Run news:fetch task | |
run: bin/rails news:fetch | |
- name: Commit updated news.yml | |
run: | | |
git config user.name "github-actions[bot]" | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
git add db/news.yml | |
if ! git diff --cached --quiet; then | |
git commit -m "chore: update news.yml via GitHub Actions" | |
git push | |
else | |
echo "No changes in db/news.yml" | |
fi |