-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (81 loc) · 2.43 KB
/
auto_update_page.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: auto update page
on:
schedule:
- cron: '0 */2 * * *'
permissions: write-all
jobs:
astro-fig:
runs-on: ubuntu-latest
environment: mastodon
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install dependencies
run: |
pip install -r requirements_ngc.txt
pip install git+https://github.com/halcy/Mastodon.py.git@1.8.1
- name: run script
env:
OAuth: ${{ secrets.MASTODON_BOT }}
run: |
python astro_jwst_news_ndays_backup.py
- name: check news
env:
OAuth: ${{ secrets.MASTODON_BOT }}
run: |
git config --global user.name "actions"
git config --global user.email "actions@github"
if [ -n "$(git status --porcelain)" ]; then
echo "IS_NEW=true" >> $GITHUB_ENV
# python mastodon_bot.py "new images on https://yuval-harpaz.github.io/astro/news_by_date.html"
else
echo "no changes"
echo "IS_NEW=false" >> $GITHUB_ENV
fi
- name: commit files
run: |
git add -A
git commit -m "auto update"
git pull
if: ${{ env.IS_NEW == 'true' }}
- name: push files
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
if: ${{ env.IS_NEW == 'true' }}
- name: run script ngc
env:
OAuth: ${{ secrets.MASTODON_BOT }}
run: |
python astro_list_ngc.py
# python astro_toot_colors.py
- name: check news ngc
run: |
git config --global user.name "actions"
git config --global user.email "actions@github"
if [ -n "$(git status --porcelain)" ]; then
echo "IS_NEW=true" >> $GITHUB_ENV
# python mastodon_bot.py "A new NGC on https://yuval-harpaz.github.io/astro/ngc.html"
else
echo "no changes"
echo "IS_NEW=false" >> $GITHUB_ENV
fi
- name: commit files ngc
run: |
git add -A
git commit -m "auto update ngc"
git pull
if: ${{ env.IS_NEW == 'true' }}
- name: push files
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
if: ${{ env.IS_NEW == 'true' }}
#- name: tweet colors
#env:
# OAuth: ${{ secrets.MASTODON_BOT }}
#run: |
# python astro_jwst_news_ndays.py