add Adobe Target (A4T) parameters to main list #11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |