Skip to content

Create github action project.yml #1

Create github action project.yml

Create github action project.yml #1

Workflow file for this run

name: project.py
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * 5'
push:
branches:
- master
- 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
- name: execute approvedfood Scrapy spider
run: scrapy crawl approvedfood_groceries -O Approvedfood.json
working-directory: ./landing_zone/collectors/ApprovedFoodUK
# 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: Configure Git
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
- name: Commit and Push Changes to the Triggered Branch
run: |
git add .
GIT_DIFF=$(git diff --staged --quiet || echo 'changes')
if [ "$GIT_DIFF" ]; then
git commit -m "Update JSON outputs"
# Extract branch name from GITHUB_REF
BRANCH_NAME=${GITHUB_REF#refs/heads/}
echo "Pushing to branch: $BRANCH_NAME"
git push origin "${BRANCH_NAME}"
else
echo "No changes to commit."
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}