-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (40 loc) · 1.3 KB
/
schedule.yml
File metadata and controls
48 lines (40 loc) · 1.3 KB
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
name: Schedule Publisher
on:
schedule:
# Run every hour at minute 0
- cron: '0 * * * *'
workflow_dispatch:
# Allow manual trigger for testing
permissions:
contents: write
jobs:
check-and-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: '3.x'
cache: 'pip'
- name: Install dependencies
run: |
pip install -r scripts/requirements.txt
- name: Run scheduler script
run: |
python scripts/publish_scheduler.py
- name: Commit and Push if changed
run: |
# Configure git
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
# Check for changes
if [[ -n $(git status -s articles/*.md) ]]; then
echo "Changes detected. Committing..."
git add articles/*.md
git commit -m "chore: auto-publish scheduled articles"
git push
else
echo "No articles published."
fi