Skip to content

Commit

Permalink
updates to workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Azaya89 committed May 1, 2024
1 parent 53eeb8e commit ceeecf0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions .github/workflows/update_data_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Update Data Workflow
on:
schedule:
- cron: '0 10 * * *' # Run every day at 10:00 UTC
workflow_dispatch: # Allows manual triggering of the workflow

jobs:
update-data:
Expand Down
12 changes: 7 additions & 5 deletions update_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,19 @@ def save_to_csv(df, file_path):

def git_commit_push():
"""Commits and pushes updated CSV file to GitHub."""
subprocess.run(['git', 'add', 'omoku_data.csv'], check=True)
try:
# Commands to add, commit, and push to GitHub
subprocess.run(['git', 'add', 'omoku_data.csv'], check=True)
subprocess.run(['git', 'commit', '-m', 'Update dataset'], check=True)
subprocess.run(['git', 'push'], check=True)
except subprocess.CalledProcessError as e:
print(f'Error in Git operation: {e}')
if "nothing to commit" in str(e):
print("No changes to commit.")
else:
print(f'Error in Git operation: {e}')

if __name__ == "__main__":
SHEET_ID = 'omoku_power_supply'
RANGE_NAME = 'data' # or whatever your range or sheet name is
SHEET_ID = '1dVa6SGm1j-z20NUDUlWSJgQffXzvJZ_a33wT_O5EOUk'
RANGE_NAME = 'data'
FILE_PATH = 'omoku_data.csv'

df = download_sheet(SHEET_ID, RANGE_NAME)
Expand Down

0 comments on commit ceeecf0

Please sign in to comment.