diff options
author | Teddy Wing | 2018-04-19 01:13:53 +0200 |
---|---|---|
committer | Teddy Wing | 2018-04-19 01:13:53 +0200 |
commit | 3c451d5f504c9872e4b589c998d52479f38aabbc (patch) | |
tree | 41dfc2de37c0db6ccb8c4fb867b06ca2e6099303 | |
parent | d8c5d44baed74adb039e9a66768818653213fe39 (diff) | |
download | redprine-3c451d5f504c9872e4b589c998d52479f38aabbc.tar.bz2 |
update_redmine_status(): Update the cache file after Redmine request
After making the request to update the Redmine issue and after checking
for an error response, update the cache file to prepend the
newly-updated pull request, marking it as one we should exclude in the
future.
-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" } |