-
Notifications
You must be signed in to change notification settings - Fork 51
320 lines (285 loc) · 11.4 KB
/
zPR_Auto_Response.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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
on:
pull_request_target:
types:
[opened, synchronize, reopened, edited]
paths:
- 'sourceData/**'
name: zPR AUTO RESPONSE
jobs:
geoBoundaryZipfileChecks:
runs-on: ubuntu-latest
container: osgeo/gdal:ubuntu-small-latest
steps:
- name: Initialize Linux Environment
run: |
echo ${{ github.event.pull_request.head.sha }}
apt-get update
apt-get install -y software-properties-common
add-apt-repository ppa:git-core/ppa
apt-get update
apt-get install -y git
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
apt-get install git-lfs
apt-get install -y python3-pip
pip3 install geopandas
pip3 install matplotlib
pip3 install PyGithub
- name: Checkout Source Directory
run: |
cd $GITHUB_WORKSPACE
cd ..
rm -r geoBoundaries
git clone --filter=blob:none --no-checkout https://github.com/wmgeolab/geoBoundaries
echo "=============="
cd geoBoundaries
echo "=============="
git sparse-checkout set "sourceData/"
git sparse-checkout add ".gitattrbutes"
git sparse-checkout add ".gitignore"
git checkout ${{ github.event.pull_request.head.sha }}
git clone https://github.com/wmgeolab/geoBoundaryBot
#- name: Download Repository Code
# uses: actions/checkout@v2.3.2
# with:
# ref: ${{ github.event.pull_request.head.sha }}
- id: changes
name: Detect Proposed Changes
uses: wmgeolab/get-changed-files@master
with:
format: 'json'
- name: Check for valid files in submission
id: checks
run: |
export changes=${{ steps.changes.outputs.added_modified }}
export gitsha=${{ github.event.pull_request.head.sha }}
echo ${{ github.event.pull_request.head.sha }}
echo ${GITHUB_WORKSPACE}
ls
echo "==============================================="
mkdir ~/tmp
python geoBoundaryBot/gbZipCheck.py
- name: Setup Artifact Upload
run: |
cp -r ~/tmp ${GITHUB_WORKSPACE}/fileChecks
ls -l ${GITHUB_WORKSPACE}/
ls -l ${GITHUB_WORKSPACE}/fileChecks
echo ==
cd ${GITHUB_WORKSPACE}
git config --global user.email "dummy@gmail.com"
git config --global user.name "DummyUser"
git config --global commit.verbose true
echo ==ADD==
git add --sparse -A .
echo ==COMMIT==
git commit -m "Artifact commit"
echo ==DONE==
git status
cd ${GITHUB_WORKSPACE}/fileChecks
git status
- name: Upload Artifacts
uses: SamKirkland/FTP-Deploy-Action@3.1.1
with:
ftp-server: ftp://ftp.geoboundaries.org/logs.geoboundaries.org/artifacts/${{ github.event.pull_request.head.sha }}
ftp-username: ${{ secrets.GBUSER }}
ftp-password: ${{ secrets.GBPASS }}
local-dir: ${{ github.workspace }}/fileChecks
- name: checkFail
run: |
python geoBoundaryBot/gbCheckFail.py
geoBoundaryMetaDataCheck:
runs-on: ubuntu-latest
container: osgeo/gdal:ubuntu-small-latest
steps:
- name: Initialize Linux Environment
run: |
apt-get update
apt-get install -y software-properties-common
add-apt-repository ppa:git-core/ppa
apt-get update
apt-get install -y git
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
apt-get install git-lfs
apt-get install -y python3-pip
pip3 install geopandas
pip3 install matplotlib
pip3 install PyGithub
- name: Checkout Source Directory
run: |
cd $GITHUB_WORKSPACE
cd ..
rm -r geoBoundaries
git clone --filter=blob:none --no-checkout https://github.com/wmgeolab/geoBoundaries
echo "=============="
cd geoBoundaries
echo "=============="
git sparse-checkout set "sourceData/"
git sparse-checkout add ".gitattrbutes"
git sparse-checkout add ".gitignore"
git checkout ${{ github.event.pull_request.head.sha }}
git clone https://github.com/wmgeolab/geoBoundaryBot
- id: changes
name: Detect Proposed Changes
uses: wmgeolab/get-changed-files@master
with:
format: 'json'
- name: Check for valid metadata in submission files
run: |
export changes=${{ steps.changes.outputs.added_modified }}
export gitsha=${{ github.event.pull_request.head.sha }}
echo ${{ github.event.pull_request.head.sha }}
echo ${GITHUB_WORKSPACE}
ls
echo "==============================================="
mkdir ~/tmp
python geoBoundaryBot/gbMetaCheck.py
- name: Setup Artifact Upload
run: |
cp -r ~/tmp ${GITHUB_WORKSPACE}/metaChecks
ls -l ${GITHUB_WORKSPACE}/
ls -l ${GITHUB_WORKSPACE}/metaChecks
echo ==
cd ${GITHUB_WORKSPACE}
git config --global user.email "dummy@gmail.com"
git config --global user.name "DummyUser"
git add --sparse -A .
git commit -m "Artifact commit"
git status
cd ${GITHUB_WORKSPACE}/metaChecks
git status
- name: Upload Artifacts
uses: SamKirkland/FTP-Deploy-Action@3.1.1
with:
ftp-server: ftp://ftp.geoboundaries.org/logs.geoboundaries.org/artifacts/${{ github.event.pull_request.head.sha }}
ftp-username: ${{ secrets.GBUSER }}
ftp-password: ${{ secrets.GBPASS }}
local-dir: ${{ github.workspace }}/metaChecks
- name: checkFail
run: |
python geoBoundaryBot/gbCheckFail.py
geoBoundaryDataCheck:
runs-on: ubuntu-latest
container: osgeo/gdal:ubuntu-small-latest
steps:
- name: Initialize Linux Environment
run: |
apt-get update
apt-get install -y software-properties-common
add-apt-repository ppa:git-core/ppa
apt-get update
apt-get install -y git
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
apt-get install -y git-lfs
apt-get install -y python3-pip
pip3 install geopandas
pip3 install matplotlib
pip3 install PyGithub
- name: Checkout Source Directory
run: |
cd $GITHUB_WORKSPACE
cd ..
rm -r geoBoundaries
git clone --filter=blob:none --no-checkout https://github.com/wmgeolab/geoBoundaries
echo "=============="
cd geoBoundaries
echo "=============="
git sparse-checkout set "sourceData/"
git sparse-checkout add ".gitattrbutes"
git sparse-checkout add ".gitignore"
git checkout ${{ github.event.pull_request.head.sha }}
git clone https://github.com/wmgeolab/geoBoundaryBot
- id: changes
name: Detect Proposed Changes
uses: wmgeolab/get-changed-files@master
with:
format: 'json'
- name: Check for valid data in submission files
run: |
export changes=${{ steps.changes.outputs.added_modified }}
export gitsha=${{ github.event.pull_request.head.sha }}
echo ${{ github.event.pull_request.head.sha }}
echo ${GITHUB_WORKSPACE}
ls
echo "==============================================="
mkdir ~/tmp
python geoBoundaryBot/gbDataCheck.py
- name: Setup Artifact Upload
run: |
cp -r ~/tmp ${GITHUB_WORKSPACE}/geometryDataChecks
ls -l ${GITHUB_WORKSPACE}/
ls -l ${GITHUB_WORKSPACE}/geometryDataChecks
echo ==
cd ${GITHUB_WORKSPACE}
git config --global user.email "dummy@gmail.com"
git config --global user.name "DummyUser"
git add --sparse -A .
git commit -m "Artifact commit"
git status
cd ${GITHUB_WORKSPACE}/geometryDataChecks
git status
- name: Upload Artifacts
uses: SamKirkland/FTP-Deploy-Action@3.1.1
with:
ftp-server: ftp://ftp.geoboundaries.org/logs.geoboundaries.org/artifacts/${{ github.event.pull_request.head.sha }}
ftp-username: ${{ secrets.GBUSER }}
ftp-password: ${{ secrets.GBPASS }}
local-dir: ${{ github.workspace }}/geometryDataChecks
- name: checkFail
run: |
python geoBoundaryBot/gbCheckFail.py
prResponse:
runs-on: ubuntu-latest
container: osgeo/gdal:ubuntu-small-latest
needs: [geoBoundaryDataCheck, geoBoundaryMetaDataCheck, geoBoundaryZipfileChecks]
if: always()
steps:
- name: Initialize Linux Environment
run: |
apt-get update
apt-get install -y software-properties-common
add-apt-repository ppa:git-core/ppa
apt-get update
apt-get install -y git
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
apt-get install -y git-lfs
apt-get install -y python3-pip
apt-get install wget
pip3 install geopandas
pip3 install matplotlib
pip3 install PyGithub
- name: Deploy geoBoundaryBot
run: git clone https://github.com/wmgeolab/geoBoundaryBot
- name: Build Response
id: buildReponse
run: |
export gitsha=${{ github.event.pull_request.head.sha }}
cd ~
mkdir tmp
cd tmp
wget -m --wait=1 --no-parent http://www.logs.geoboundaries.org/artifacts/${{ github.event.pull_request.head.sha }}/
echo "==="
ls -l ~/tmp/www.logs.geoboundaries.org/artifacts/${{ github.event.pull_request.head.sha }}
echo "---"
cd ${GITHUB_WORKSPACE}
ls -l
pip install geopandas
pip3 install geopandas
python geoBoundaryBot/gbResponse.py
echo "==="
cat ~/tmp/response.txt
- uses: pCYSl5EDgo/cat@master
id: gatherResponse
with:
path: ~tmp/response.txt
- run: echo $RESPONSE
env:
RESPONSE: ${{ steps.gatherResponse.outputs.text }}
- uses: actions/github-script@v3
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.issues.createComment({
issue_number: ${{github.event.number}},
owner: context.repo.owner,
repo: context.repo.repo,
body: "${{ steps.gatherResponse.outputs.text }}"
})