-
-
Notifications
You must be signed in to change notification settings - Fork 0
183 lines (164 loc) · 5.82 KB
/
Create_database.yaml
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
name: XML Database Creation
on:
push:
pull_request_target:
jobs:
Create_database:
name: Create XML database
runs-on: ubuntu-latest
steps:
- name: Checkout repo content
uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
run: |
pip install -r requirements.txt
sudo apt-get install libxml2-utils
- name: Reconfigure locales
run: |
sudo locale-gen it_IT.UTF-8
sudo locale-gen en_GB.UTF-8
sudo locale-gen nl_NL.UTF-8
- name: Execute ci_script_check_making_database
continue-on-error: true
run: |
python3 python/ci_script_check_making_database.py 2> outputs/STDERR 1> outputs/STDOUT
- name: Set STDERR variable
id: STDERR
run: |
if [ $(wc -l < outputs/STDERR) -ge 2 ]
then
echo ::set-output name=full::true
else
echo ::set-output name=empty::true
fi
- name: Set XMLERR variable
id: XMLERR
run: |
if [ $(wc -l < outputs/xml_errors) -gt 0 ]
then
echo ::set-output name=full::true
else
echo ::set-output name=empty::true
fi
# Create error commit comment
- name: Get error comment body
id: get-comment-body-error
if: ${{ steps.STDERR.outputs.full }}
run: |
body=$(cat outputs/STDERR)
body="${body//'%'/'%25'}"
body="${body//$'\n'/'%0A'}"
body="${body//$'\r'/'%0D'}"
echo ::set-output name=body::$body
- name: Create errors commit comment
if: ${{ steps.STDERR.outputs.full }}
uses: peter-evans/commit-comment@v3
with:
body: |
**An error occurred when trying to create the database!**
The following was the error, contact Daniël if the error is not clear:
```python
${{ steps.get-comment-body-error.outputs.body }}
```
# Create XML DTD comment
- name: Get XML-DTD comment body
if: ${{ steps.XMLERR.outputs.full }}
id: get-xml-dtd-errors
run: |
body=$(cat outputs/xml_errors)
body="${body//'%'/'%25'}"
body="${body//$'\n'/'%0A'}"
body="${body//$'\r'/'%0D'}"
echo ::set-output name=body::$body
- name: Create XML-DTD commit comment
if: ${{ steps.XMLERR.outputs.full }}
uses: peter-evans/commit-comment@v3
with:
body: |
**An error occurred when trying to create the database!**
<details>
<summary>
Found the following erros in the created XML database.
</summary>
Standard errors include:
- `element dao: validity error : ID xxx already defined` means that that file ID xxx occurs multiple times
```python
${{ steps.get-xml-dtd-errors.outputs.body }}
```
</details>
# Get input for commit comment
- name: Get titles comment body
id: get-comment-body-titles
if: ${{ steps.STDERR.outputs.empty && steps.XMLERR.outputs.empty }}
run: |
body=$(cat outputs/missing_titles)
body="${body//'%'/'%25'}"
body="${body//$'\n'/'%0A'}"
body="${body//$'\r'/'%0D'}"
echo ::set-output name=body::$body
- name: Get translations comment body
id: get-comment-body-translations
if: ${{ steps.STDERR.outputs.empty && steps.XMLERR.outputs.empty }}
run: |
body=$(cat outputs/missing_translations)
body="${body//'%'/'%25'}"
body="${body//$'\n'/'%0A'}"
body="${body//$'\r'/'%0D'}"
echo ::set-output name=body::$body
- name: Get title errors comment body
id: get-title-errors-body-translations
if: ${{ steps.STDERR.outputs.empty && steps.XMLERR.outputs.empty }}
run: |
body=$(cat outputs/title_errors)
body="${body//'%'/'%25'}"
body="${body//$'\n'/'%0A'}"
body="${body//$'\r'/'%0D'}"
echo ::set-output name=body::$body
# Create commit comment
- name: Create commit comment
if: ${{ steps.STDERR.outputs.empty && steps.XMLERR.outputs.empty }}
uses: peter-evans/commit-comment@v3
with:
body: |
<details>
<summary>
These are the currently missing titles:</summary>
${{ steps.get-comment-body-titles.outputs.body }}
</details>
<details>
<summary>
These are the currently missing translations:</summary>
${{ steps.get-comment-body-translations.outputs.body }}
</details>
<details>
<summary>
These are the errors found in titles:</summary>
${{ steps.get-title-errors-body-translations.outputs.body }}
</details>
# Create output log comment
- name: Get log comment body
id: get-log-body-translations
run: |
body=$(cat outputs/STDOUT)
body="${body//'%'/'%25'}"
body="${body//$'\n'/'%0A'}"
body="${body//$'\r'/'%0D'}"
echo ::set-output name=body::$body
- name: Create log commit comment
uses: peter-evans/commit-comment@v3
with:
body: |
<details>
<summary>
This is the rest of the output log. Please check for additional errors:</summary>
```python
${{ steps.get-log-body-translations.outputs.body }}
```
# Actually fail on error
- name: Check if errors occurred
if: ${{ steps.STDERR.outputs.full || steps.XMLERR.outputs.full }}
run: exit 1