Skip to content

Commit

Permalink
add github action
Browse files Browse the repository at this point in the history
  • Loading branch information
Piet Brömmel committed May 9, 2024
1 parent 0c9b3f6 commit 8cd1b1c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
30 changes: 22 additions & 8 deletions .github/workflows/data_update.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,40 @@
name: Run Python Script
name: update data

on:
push:
branches:
- main
schedule:
# TODO: should run at 0:00 6:00 12:00 and 16:00 o'clock every day.
- cron: '0 8 * * 1'
workflow_dispatch:

jobs:
run-python:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
python-version: '3.10'

- name: Install Dependencies
run: pip install -r requirements.txt

- name: Run Python Script
- name: Fetch Data
env:
API_KEY: ${{ secrets.API_KEY }}
run: python your_script.py
CLIENT_ID: ${{ secrets.CLIENT_ID }}
run: python fetch_data.py

- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
add-paths: |
data/*
commit-message: data update
committer: GitHub <[email protected]>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
delete-branch: true
title: 'Update Deutsche Bahn data'
body: 'Update Deutsche Bahn data'
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
requests

0 comments on commit 8cd1b1c

Please sign in to comment.