Update file(s) #2376
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 */12 * * *" # run every 2 hours | |
jobs: | |
update: | |
runs-on: ubuntu-latest | |
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: Format code | |
run: black simple.py | |
- name: Fetch data and update the file(s) | |
run: python simple.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 | |
# - name: Push file to remote repo | |
# uses: dmnemec/copy_file_to_another_repo_action@main | |
# env: | |
# API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }} | |
# with: | |
# source_file: nepse_simple.xlsx | |
# destination_repo: dotehacker/dotehacker.github.io | |
# user_name: dotehacker | |
# user_email: rockerritesh4@gmail.com | |
# target-branch: main |