diff options
-rwxr-xr-x | redprine | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -170,13 +170,15 @@ function update_redmine_status () { if [ "$status_code" != '200' ]; then exit_with_error "Redmine API error, status code $status_code" fi + + update_cache_with_new_pull "$pull_request" } -# Updates the cache file appending new pull requests in our JSON format. -function update_cache_with_new_pulls () { - local new_pull_requests="$1" +# Updates the cache file, appending a new pull request in our JSON format. +function update_cache_with_new_pull () { + local pull_request="$1" - jq "$new_pull_requests" "$CACHE_FILE" > "${CACHE_FILE}.new" + jq "[$pull_request] + ." "$CACHE_FILE" > "${CACHE_FILE}.new" mv "${CACHE_FILE}.new" "$CACHE_FILE" } |