jq bash loop #17
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: jq bash loop | |
on: | |
workflow_dispatch: | |
jobs: | |
jq_bash_loop: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
- name: test to see if helm installed | |
run: | | |
helm version | |
- name: prepare file | |
run: | | |
cat > tf << EOF | |
[ | |
{ | |
"project": "en.wikipedia", | |
"timestamp": "2021092800", | |
"access": "all-access", | |
"agent": "\nagent11 \n agent12", | |
"views": 381 | |
}, | |
{ | |
"project": "en.wikipedia", | |
"timestamp": "2021092900", | |
"access": "all-access", | |
"agent": "all-agents", | |
"views": 419 | |
}, | |
{ | |
"project": "en.wikipedia", | |
"timestamp": "2021093000", | |
"access": "all-access", | |
"agent": "\nagent33 \n agent34", | |
"views": 408 | |
} | |
] | |
EOF | |
cat tf | |
- name: run bash jq | |
run: | | |
aa=$(echo '[{"aa": " \n aa33 \n aa44"}, {"aa": " \n aaXX \n aaYY"}]' | jq '.') | |
# echo $aa | |
# echo $aa | jq -r '.' | |
# echo $aa | jq -r '.[0].aa' | |
# dd=$(echo $aa | jq -c '.[]' ) | |
# for r in $dd; do | |
# echo $r | |
# echo $r | jq '.aa' | |
# done | |
- name: test github ref_name and github.sha | |
run: | | |
echo "github.ref_name: [${{ github.ref_name }}] " | |
echo "github.sha: [${{ github.sha }}] " | |
echo "combo: [${{ format('{0}.{1}', github.ref_name, github.sha) }}]" |