diff --git a/.github/workflows/data_update.yml b/.github/workflows/data_update.yml index 2df6a03a509..c076c1d50fd 100644 --- a/.github/workflows/data_update.yml +++ b/.github/workflows/data_update.yml @@ -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 + author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> + delete-branch: true + title: 'Update Deutsche Bahn data' + body: 'Update Deutsche Bahn data' \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000000..663bd1f6a2a --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +requests \ No newline at end of file