-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (76 loc) · 3.19 KB
/
validate.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
name: Validate files
on:
workflow_dispatch:
inputs:
with-relationship:
type: boolean
description: Check box to validate with relationships
skip-geonames:
type: boolean
description: Check box to skip Geonames validation
directory-name:
type: string
description: Name of parent directory containing records to validate. Needed only if different from branch name.
jobs:
validate-files:
runs-on: ubuntu-latest
if: github.event.ref != 'refs/heads/main'
steps:
- name: checkout
uses: actions/checkout@v2
with:
ref: ${{ github.event.ref }}
- name: Set up Python environment
uses: actions/setup-python@v2
with:
python-version: "3.8"
- name: Checkout validation suite
uses: actions/checkout@v2
with:
repository: ror-community/validation-suite
path: validation-suite
- name: Get directory name
if: "${{ github.event.inputs.directory-name != '' }}"
run: echo "WORKING_DIR=${{ github.event.inputs.directory-name }}" >> $GITHUB_ENV
- name: Get branch name
if: "${{ github.event.inputs.directory-name == '' }}"
run: echo "WORKING_DIR=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
- name: Validate files
id: validatefiles
run: |
mkdir files
cp ./${{ env.WORKING_DIR }}/*.json files/
cd validation-suite
python -m pip install --upgrade pip
pip install -r requirements.txt
ls ../files/
if [[ ${{ github.event.inputs.skip-geonames }} == true ]]; then
if [[ ${{ github.event.inputs.with-relationship }} == true ]]; then
if [[ -f "../${{ env.WORKING_DIR }}/relationships.csv" ]]; then
python run_validations.py -i ../files -f ../${{ env.WORKING_DIR }}/relationships.csv -p ../files/ --no-geonames
else
python run_validations.py -i ../files -p ../files/ --no-geonames
fi
elif [[ ${{ github.event.inputs.with-relationship }} == false ]]; then
python run_validations.py -i ../files --no-geonames
fi
else
if [[ ${{ github.event.inputs.with-relationship }} == true ]]; then
if [[ -f "../${{ env.WORKING_DIR }}/relationships.csv" ]]; then
python run_validations.py -i ../files -f ../${{ env.WORKING_DIR }}/relationships.csv -p ../files/
else
python run_validations.py -i ../files -p ../files/
fi
elif [[ ${{ github.event.inputs.with-relationship }} == false ]]; then
python run_validations.py -i ../files
fi
fi
- name: Notify Slack
if: always()
uses: edge/simple-slack-notify@master
env:
SLACK_WEBHOOK_URL: ${{ secrets.CURATOR_SLACK_WEBHOOK_URL }}
with:
channel: '#ror-curation-releases'
color: 'good'
text: 'Validation status ${{ steps.validatefiles.outcome }} in ${env.GITHUB_REPOSITORY}. On branch: ${{ env.WORKING_DIR }}. Please check: ${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/actions/runs/${env.GITHUB_RUN_ID}'