Skip to content

Sync

Sync #5158

Workflow file for this run

name: Sync
on:
workflow_dispatch:
env:
CLIENT_IDS: ${{secrets.CLIENT_IDS}}
CLIENT_SECRETS: ${{secrets.CLIENT_SECRETS}}
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Set environment variables
run: |
echo BRANCH_NAME=$(node -e 'console.log(new Date().toISOString().split("T")[0])') >> $GITHUB_ENV
echo FETCH_DEPTH=$(node -e 'console.log(new Date().getHours() === 23 ? 0 : 1)') >> $GITHUB_ENV
- name: Checkout daily branch
uses: actions/checkout@v4
id: checkout-daily-branch
continue-on-error: true
with:
ref: ${{env.BRANCH_NAME}}
fetch-depth: ${{env.FETCH_DEPTH}}
- name: Checkout main branch
uses: actions/checkout@v4
id: checkout-main-branch
if: always() && steps.checkout-daily-branch.outcome == 'failure'
with:
ref: main
- name: Create daily branch
id: create-daily-branch
if: always() && steps.checkout-main-branch.outcome == 'success'
run: |
git checkout -b ${{env.BRANCH_NAME}}
- name: Configure git user
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
bundler-cache: true
- name: Install gems
run: bundle install
- name: Sync data
run: ruby scripts/sync.rb
- name: Commit and push
run: ruby scripts/commit_and_push.rb