Skip to content

Run Action Python script #20

Run Action Python script

Run Action Python script #20

Workflow file for this run

name: Run Action Python script
on:
schedule:
- cron: '1 */6 * * *' # runs at the first minute of every 6th hour. (12:01a, 6:01a, 12:01p, and 6:01p)
workflow_dispatch: # Allow manual triggering of the workflow
jobs:
run_script_1:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install requests beautifulsoup4
- name: Run Data.py Python script
run: |
echo "Running data.py"
python data.py
- name: Commit changes
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions"
git add data/data1.json || git commit -m "Create data1.json"
git commit -m "Update data1.json" || echo "No changes to commit"
git pull origin main || echo "No remote changes to pull"
git push origin main
run_script_2:
runs-on: ubuntu-latest
needs: [run_script_1]
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install requests beautifulsoup4
- name: Run Data2.py Python script
run: |
echo "Running data2.py"
python data.py
- name: Commit changes
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions"
git add data/data2.json || git commit -m "Create data2.json"
git commit -m "Update data2.json" || echo "No changes to commit"
git pull origin main || echo "No remote changes to pull"
git push origin main
run_script_3:
runs-on: ubuntu-latest
needs: [run_script_2]
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Run json_manager.py Python script
run: |
echo "Running json_manager.py"
python json_manager.py
- name: Commit changes
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions"
git add data/merged_data.json || git commit -m "Create data/merged_data.json"
git commit -m "Update data/merged_data.json" || echo "No changes to commit"
git pull origin main || echo "No remote changes to pull"
git push origin main
- name: Push changes
uses: ad-m/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: main