Update Articles #135
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: 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 }} |