-
Notifications
You must be signed in to change notification settings - Fork 1
54 lines (46 loc) · 1.69 KB
/
file_outputs_action.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
name: Extract table values
on:
push:
branches:
- main
jobs:
extract:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Remove existing parameter_list.csv
uses: JesseTG/[email protected]
with:
path: parameter_list.csv
- name: Remove existing parameter_array.js
uses: JesseTG/[email protected]
with:
path: parameter_array.js
- name: Commit removed files
run: |
git config user.name github-actions
git config user.email [email protected]
git commit -am "Remove previous version of parameters list and array files"
- name: Extract platform click id parameters from README.md and generate .csv file
run: |
table=$(awk -F '|' '{if (start && !end) print $2} /---start---/{start=1} /---end---/{end=1}' README.md | tail -n+4 | sed 's/`//g' | sed 's/ //g' | sed -z 's/\n/,/g;s/,$/\n/' | sed 's/..$//')
echo "$table"
echo "$table" > parameter_list.csv
- name: Use .csv file to generate a parameter_array.js file
run: |
input_list=$(cat parameter_list.csv)
IFS=',' read -ra input_array <<< "$input_list"
output_string="["
for val in "${input_array[@]}"
do
output_string+="'"$val"',"
done
output_string="${output_string%,}]"
echo "$output_string"
echo "$output_string" > parameter_array.js
- name: Commit and push both files
run: |
git add parameter_list.csv parameter_array.js
git commit -m "Autogenerate parameter_list.csv and parameter_array.js"
git push