Sync #5966
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 | |
on: | |
schedule: | |
- cron: "0 * * * *" | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
run: | |
runs-on: ubuntu-latest | |
concurrency: overcast | |
steps: | |
- name: Checkout main branch | |
uses: actions/checkout@v4 | |
- name: Checkout data branch | |
uses: actions/checkout@v4 | |
with: | |
ref: "data" | |
path: "data" | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version-file: "pyproject.toml" | |
- uses: astral-sh/setup-uv@v5 | |
- name: Install dependencies | |
run: | | |
uv pip install --system --requirement requirements.txt | |
- name: Load cache | |
uses: actions/cache@v4 | |
with: | |
path: .cache/ | |
key: cache-${{ github.run_id }} | |
restore-keys: | | |
cache- | |
- name: Sync | |
run: | | |
python main.py --db-path data/ \ | |
refresh-opml-export \ | |
refresh-feeds-index \ | |
refresh-feeds --limit 5 \ | |
backfill-episode --randomize-order --limit 20 \ | |
metrics --metrics-filename data/metrics.prom \ | |
purge-cache | |
env: | |
XDG_CACHE_HOME: .cache/ | |
OVERCAST_COOKIE: ${{ secrets.OVERCAST_COOKIE }} | |
ENCRYPTION_KEY: ${{ secrets.ENCRYPTION_KEY }} | |
- name: Commit changes | |
id: commit | |
run: | | |
git config user.name "github-actions[bot]" | |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git add . | |
if git commit --message "Update data"; then | |
echo "committed=true" >>"$GITHUB_OUTPUT" | |
else | |
echo "committed=false" >>"$GITHUB_OUTPUT" | |
fi | |
working-directory: data/ | |
- name: Push changes | |
if: steps.commit.outputs.committed == 'true' | |
run: git push origin refs/heads/data | |
working-directory: data/ |