Skip to content

Commit 28c51d7

Browse files
authored
Create automation.yml
1 parent 8af0162 commit 28c51d7

1 file changed

Lines changed: 49 additions & 0 deletions

File tree

.github/workflows/automation.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Substack Bot Automation
2+
3+
on:
4+
schedule:
5+
# Run every weekday at 9:30 AM EST (2:30 PM UTC)
6+
- cron: '30 14 * * 1-5'
7+
workflow_dispatch: # Allow manual trigger
8+
inputs:
9+
run_immediately:
10+
description: 'Run the bot immediately'
11+
required: false
12+
default: 'true'
13+
type: boolean
14+
15+
jobs:
16+
run-substack-bot:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v4
22+
23+
- name: Set up Python
24+
uses: actions/setup-python@v4
25+
with:
26+
python-version: '3.11'
27+
28+
- name: Install dependencies
29+
run: |
30+
python -m pip install --upgrade pip
31+
pip install -r requirements.txt
32+
playwright install chromium
33+
34+
- name: Run Substack Bot
35+
env:
36+
SUBSTACK_EMAIL: ${{ secrets.SUBSTACK_EMAIL }}
37+
SUBSTACK_PASSWORD: ${{ secrets.SUBSTACK_PASSWORD }}
38+
run: |
39+
python substack_bot.py
40+
41+
- name: Upload logs (if failure)
42+
if: failure()
43+
uses: actions/upload-artifact@v3
44+
with:
45+
name: bot-logs
46+
path: |
47+
*.log
48+
screenshots/
49+
retention-days: 7

0 commit comments

Comments
 (0)