Skip to content

Commit

Permalink
use JSON for sitrep
Browse files Browse the repository at this point in the history
  • Loading branch information
yhtang committed Sep 3, 2023
1 parent 95d2716 commit 0f1ffb9
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/_util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

# convert a list of variables to a json dictionary
function to_json() {
jq -n \
$(for var in "$@"; do echo --arg $var "${!var}"; done) \
"{$(for var in "$@"; do echo "\"$var\": \$$var",; done)}"
}
eval $(echo jq -n \
$(for var in "$@"; do echo --arg $var "'"${!var}"'"; done) \
\'"{$(for var in "$@"; do echo -n "\"$var\": \$$var, "; done)}"\'
)
}

0 comments on commit 0f1ffb9

Please sign in to comment.