-
Notifications
You must be signed in to change notification settings - Fork 3
180 lines (150 loc) · 5.63 KB
/
project.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
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: ./landing_zone/collectors/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 "[email protected]"
git config --local user.name "GitHub Action"
- name: Commit and Push Changes to the Triggered Branch
run: |
git config --global user.email "[email protected]"
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] # Ensure these jobs are defined elsewhere in your workflow
# runs-on: ubuntu-latest
# steps:
# - name: Notify Slack
# uses: 8398a7/action-slack@v3
# with:
# status: custom
# custom_payload: |
# {
# attachments: [{
# color: '${{ needs.run_Mealdb.outputs.status }}' === 'success' && '${{ needs.run_ApprovedFood.outputs.status }}' === 'success' ? 'good' : 'danger',
# text: `Workflow: ${{ github.workflow }}\nJob: Detailed Status Update\n- Mealdb Script Status: ${{ needs.run_Mealdb.outputs.status }}\n- ApprovedFood Script Status: ${{ needs.run_ApprovedFood.outputs.status }}\nCommit: ${{ github.sha }}\nAuthor: ${{ github.actor }}\nRepo: ${{ github.repository }}`
# }]
# }
# env:
# SLACK_WEBHOOK_URL: "https://hooks.slack.com/services/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"
# if: always()