Skip to content

Commit

Permalink
Merge pull request #276 from eirnym/publish-format-msg
Browse files Browse the repository at this point in the history
Use conditional jq to format message
  • Loading branch information
boozook authored Apr 5, 2024
2 parents 3632ddf + 498fa0e commit 5844185
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,7 @@ jobs:
env:
CRATES: ${{ steps.publisher.outputs.published }}
run: |
INTRO="${{ steps.counter.outputs.value > 1 && 'Crates updated: \n' || 'Crate updated: ' }}"
MESSAGE_LIST=${INTRO}$(echo $CRATES | jq -r 'to_entries[] | "\(.key+1). \(.value.name): v\(.value.version)"')
MESSAGE_LINE=${INTRO}$(echo $CRATES | jq -r 'to_entries[] | "\(.value.name) v\(.value.version)"')
MESSAGE="${{ steps.counter.outputs.value > 1 && '${MESSAGE_LIST}' || ' ${MESSAGE_LINE}' }}"
MESSAGE=$(echo $CRATES | jq -r 'if length == 1 then "Crate updated: \(.[0].name) v\(.[0].version)" else ("Crates updated:"), (to_entries[] | "\(.key + 1). \(.value.name): v\(.value.version)") end')
echo "value<<EOF" >> $GITHUB_OUTPUT
echo $MESSAGE >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
Expand Down

0 comments on commit 5844185

Please sign in to comment.