Sync GitHub Repo Data #1427
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: Sync GitHub Repo Data | |
on: | |
schedule: | |
- cron: '0 */3 * * *' | |
workflow_dispatch: | |
jobs: | |
run_script: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 3.2 | |
bundler-cache: true | |
- name: Cache dependencies | |
uses: actions/cache@v2 | |
with: | |
path: ~/.bundle | |
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} | |
restore-keys: | | |
${{ runner.os }}-gems- | |
- name: Install dependencies | |
run: | | |
bundle install | |
- name: Migration | |
env: | |
DATABASE_URL: ${{ secrets.DATABASE_URL }} | |
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN || secrets.GITHUB_TOKEN }} | |
REPO_FULL_NAME: ${{ secrets.REPO_FULL_NAME }} | |
PYPI_PACKAGE: ${{ secrets.PYPI_PACKAGE }} | |
run: | | |
bundle exec rails runner "RetryableRake.db_create" | |
bundle exec rails runner "RetryableRake.db_migrate" | |
- name: Sync GitHub Repo Data | |
env: | |
DATABASE_URL: ${{ secrets.DATABASE_URL }} | |
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN || secrets.GITHUB_TOKEN}} | |
REPO_FULL_NAME: ${{ secrets.REPO_FULL_NAME }} | |
PYPI_PACKAGE: ${{ secrets.PYPI_PACKAGE }} | |
run: | | |
bundle exec rails runner "SyncGithub.run!" | |
- name: Rebuild Evidence | |
run: | | |
if [ -n "${{ secrets.BUILD_HOOK }}" ]; then | |
curl -X POST -d {} ${{ secrets.BUILD_HOOK }} | |
fi |