auto update page #6940
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | |
MOAuth: ${{ secrets.MASTO }} | |
Blueword: ${{ secrets.BWORD }} | |
Bluehandle: ${{ secrets.BNDL }} | |
run: | | |
python astro_jwst_news_ndays_backup.py | |
- name: check news | |
env: | |
MOAuth: ${{ secrets.MASTO }} | |
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: | |
MOAuth: ${{ secrets.MASTO }} | |
run: | | |
python astro_list_ngc.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' }} | |