Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Account Backup

# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
schedule:
- cron: '0 */4 * * *'

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8]

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Run the script
run: |
python main.py
- name: Update the file
run: |
git config --global user.name 'dhakal0kushal'
git config --global user.email '[email protected]@users.noreply.github.com'
git add .
git commit -m "Automated report"
git push

4 changes: 2 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def run():
"""

now = datetime.now()
date_time = now.strftime('%Y-%m-%d-%H:%M:%S')
date_time = now.strftime('%Y-%m-%d-%H_%M_%S')
file_path = os.path.join(ACCOUNT_BACKUPS_DIR, f'{date_time}.json')
data = format_results(fetch_account_data())
verify_results(data=data)
Expand All @@ -58,7 +58,7 @@ def verify_results(*, data):
if total == MAX_POINT_VALUE:
print('\nValid')
else:
print('\nInvalid')
raise Exception("Invalid!!")


if __name__ == '__main__':
Expand Down