-
Notifications
You must be signed in to change notification settings - Fork 1
53 lines (44 loc) · 1.31 KB
/
update-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
53
name: Update Articles
on:
workflow_dispatch:
schedule:
- cron: '0 13 * * 4' # Run every Thursday at 9 AM EST (13:00 UTC)
jobs:
update-articles:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
token: ${{ secrets.GH_TOKEN }}
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install requests beautifulsoup4 pandas pytz
- name: Run app.py
run: python app.py
- name: Check for changes
id: check_changes
run: |
if git diff --quiet README.md && git diff --quiet articles/; then
echo "No changes detected."
echo "changed=false" >> $GITHUB_ENV
else
echo "Changes detected."
echo "changed=true" >> $GITHUB_ENV
fi
- name: Commit changes
if: env.changed == 'true'
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add README.md articles/
git commit -m "Update articles and README.md"
- name: Push changes
if: env.changed == 'true'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GH_TOKEN }}