Update file(s) #626
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 file(s) | |
on: | |
push: | |
branches: [ main ] | |
schedule: | |
- cron: "0 */6 * * *" # every 6 hours | |
jobs: | |
update: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install black | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
- name: Install newspaper | |
run: | | |
git clone https://github.com/dailydotdev/newspaper | |
cd newspaper | |
pip install -r requirements.txt | |
python setup.py install | |
cd .. | |
- name: Format code | |
run: black run.py | |
- name: Fetch data and update the file(s) | |
run: python run.py | |
# - name: Classify the data | |
# run: python classify.py | |
- name: Commit updated file(s) back to this repository | |
run: | | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
git add . | |
git diff-index --quiet HEAD || git commit -m "[skip ci] Save result of action" | |
git fetch origin main | |
git push origin HEAD:main | |
env: | |
GITHUB_TOKEN: ${{ secrets.SECRET_GH }} | |