Skip to content

Update project.yml

Update project.yml #19

Workflow file for this run

# name: project.py
# on:
# schedule:
# - cron: '0 0 * * 5' # At 00:00 on Friday
# push:
# branches:
# - main
# jobs:
# build:
# runs-on: ubuntu-latest
# steps:
# - name: checkout repo content
# uses: actions/checkout@v2
# - name: setup python
# uses: actions/setup-python@v4
# with:
# python-version: '3.10'
# - name: install python packages
# run: |
# python -m pip install --upgrade pip
# pip install -r requirements.txt
# # Scrapy spiders
# - name: execute mealdb Scrapy spider
# run: scrapy crawl mealdb -O mealdb.json
# working-directory: ./landing_zone/collectors/Mealdb/mealscraper
# - name: execute approvedfood Scrapy spider
# run: scrapy crawl approvedfood_groceries -O Approvedfood.json
# working-directory: ./landing_zone/collectors/ApprovedFoodUK/approvedfood_scraper
# # Python scripts
# # - name: execute eat_by_date.py script
# # run: python eat_by_date.py
# # working-directory: ./landing_zone/collectors/eat_by_date
# # - name: execute flipkart.py script
# # run: python scrap_flipkart.py
# # working-directory: ./Flipkart
# - name: Notify Slack
# uses: 8398a7/action-slack@v3
# with:
# status: ${{ job.status }}
# fields: workflow,job,commit,repo,ref,author,took
# text: 'Job done. Workflow: ${{ github.workflow }}. Status: ${{ job.status }}.'
# webhook_url: ${{ secrets.SLACK_WEBHOOK }}
# if: always()
# - name: Configure Git
# run: |
# git config --local user.email "61274755+Pce-iyos@users.noreply.github.com"
# git config --local user.name "GitHub Action"
# - name: Commit and Push Changes to the Triggered Branch
# run: |
# git config --global user.email "61274755+Pce-iyos@users.noreply.github.com"
# git config --global user.name "GitHub Action"
# git add .
# if git diff --quiet --staged; then
# echo "No changes to commit."
# else
# git commit -m "Update JSON outputs"
# git push origin HEAD
# fi
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
name: project.py
on:
schedule:
- cron: '0 0 * * 5' # At 00:00 on Friday
push:
branches:
- main
jobs:
run_Mealdb:
runs-on: ubuntu-latest
outputs:
script_name: 'Mealdb Script'
status: ${{ steps.set_status.outputs.status }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Cache Python packages
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Execute mealdb Scrapy spider
run: scrapy crawl mealdb -O mealdb.json
working-directory: ./landing_zone/collectors/Mealdb/mealscraper
- name: Set job status
id: set_status
if: always()
run: |
echo "Job completed with status success."
echo "::set-output name=status::success"
run_ApprovedFood:
runs-on: ubuntu-latest
outputs:
script_name: 'ApprovedFood Script'
status: ${{ steps.set_status.outputs.status }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Cache Python packages
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Execute approvedfood Scrapy spider
run: scrapy crawl approvedfood_groceries -O Approvedfood.json
working-directory: ./landing_zone/collectors/ApprovedFoodUK/approvedfood_scraper
- name: Set job status
id: set_status
if: always()
run: |
echo "Job completed with status success."
echo "::set-output name=status::success"
notify_slack:
needs: [run_Mealdb, run_ApprovedFood]
runs-on: ubuntu-latest
steps:
- name: Send aggregated message to Slack
uses: 8398a7/action-slack@v3
with:
text: |
All jobs completed!
- *Mealdb Script Status*: ${{ needs.run_Mealdb.outputs.status }}
- *ApprovedFood Script Status*: ${{ needs.run_ApprovedFood.outputs.status }}
author_name: 8398a7@action-slack
env:
SLACK_WEBHOOK_URL: "https://hooks.slack.com/services/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"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}