Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions .github/workflows/daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,35 @@ jobs:
echo "FOUND_NEWS=false" >> $GITHUB_OUTPUT
fi

run-on-heroku:
needs: daily
runs-on: ubuntu-latest
timeout-minutes: 15

steps:
- name: 📦 Install Heroku CLI
run: curl https://cli-assets.heroku.com/install.sh | sh

- name: 📅 Run upcoming_events:aggregation on Heroku
run: |
heroku run rails upcoming_events:aggregation --app $HEROKU_APP_NAME
env:
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
HEROKU_APP_NAME: ${{ secrets.HEROKU_APP_NAME }}

deploy:
needs: daily
if: ${{ needs.daily.outputs.FOUND_NEWS == 'true' }}
# TODO: ubuntu-latest image needs to install heroku CLI to deploy.
# https://github.com/AkhileshNS/heroku-deploy/issues/188
runs-on: ubuntu-22.04

steps:
- name: ☑️ Checkout code
uses: actions/checkout@v4
with:
ref: main

- name: 🚀 Deploy to Heroku
uses: akhileshns/heroku-deploy@v3.14.15
with:
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/weekly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Weekly Workflow

on:
schedule:
# 毎週月曜 1:00 AM UTC (日本時間 10:00 AM)
- cron: '0 1 * * 1'
# Allows you to run this workflow manually from the Actions tab
# https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow
workflow_dispatch:

jobs:
run-on-heroku:
runs-on: ubuntu-latest
timeout-minutes: 15

steps:
- name: 📦 Install Heroku CLI
run: curl https://cli-assets.heroku.com/install.sh | sh

- name: 📊 Run statistics:aggregation on Heroku
run: |
heroku run rails statistics:aggregation --app $HEROKU_APP_NAME
env:
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
HEROKU_APP_NAME: ${{ secrets.HEROKU_APP_NAME }}
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,16 +173,18 @@ bundle exec rails podcasts:upsert

<div id='howto-develop-jobs'></div><br>

### [:alarm_clock:](#howto-develop-jobs) 定期的に実行されるスクリプト (Heroku Scheduler)
### [:alarm_clock:](#howto-develop-jobs) 定期的に実行されるスクリプト (GitHub Actions)

以下のコマンドは上記 CI とは関係なく、定期的に実行されます
以下のコマンドは上記 CI とは関係なく、GitHub Actions で定期的に実行されます

```console
# 【毎日】近日開催のイベント収集 (Daily at 9:00 PM UTC)
# 【毎日】近日開催のイベント収集 (Daily at 0:00 UTC / 9:00 JST)
# 実行タイミング: .github/workflows/daily.yml
$ bundle exec rails upcoming_events:aggregation

# 【毎週】統計情報ページ用のデータ収集 (Daily at 1:00 AM UTC)
$ [ $(date +%u) = 1 ] && bundle exec rails statistics:aggregation
# 【毎週】統計情報ページ用のデータ収集 (Weekly on Monday at 1:00 AM UTC / 10:00 AM JST)
# 実行タイミング: .github/workflows/weekly.yml
$ bundle exec rails statistics:aggregation
```


Expand Down
2 changes: 1 addition & 1 deletion db/dojo_event_services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
- dojo_id: 350
name: doorkeeper
group_id: 104819
url: https://saijo.doorkeeper.jp/
url: https://coderdojo-saijo.doorkeeper.jp/

# SAGA @ 駅前中央(佐賀県佐賀市)
- dojo_id: 349
Expand Down