-
Notifications
You must be signed in to change notification settings - Fork 1
52 lines (42 loc) · 1.53 KB
/
sync_articles.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
name: Sync Readwise Articles to Capacities
on:
workflow_dispatch: # Keep manual trigger
schedule:
- cron: "0 3 * * *" # Runs at midnight São Paulo time (UTC-3)
permissions:
contents: write # This allows the workflow to push changes
actions: read # This is for basic workflow functionality
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Create empty processed_ids file if it doesn't exist
run: touch processed_ids.txt
- name: Run sync script
env:
READWISE_TOKEN: ${{ secrets.READWISE_TOKEN }}
CAPACITIES_TOKEN: ${{ secrets.CAPACITIES_TOKEN }}
CAPACITIES_SPACE_ID: ${{ secrets.CAPACITIES_SPACE_ID }}
run: python main.py
- name: Commit and push if processed_ids.txt changed
run: |
git config --global user.name 'GitHub Action'
git config --global user.email '[email protected]'
# Check if there are any changes to processed_ids.txt
if git status --porcelain | grep "processed_ids.txt"; then
git add processed_ids.txt
git commit -m "Update processed articles list [skip ci]"
git push
else
echo "No changes to processed_ids.txt"
fi