aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2018-04-19 01:13:53 +0200
committerTeddy Wing2018-04-19 01:13:53 +0200
commit3c451d5f504c9872e4b589c998d52479f38aabbc (patch)
tree41dfc2de37c0db6ccb8c4fb867b06ca2e6099303
parentd8c5d44baed74adb039e9a66768818653213fe39 (diff)
downloadredprine-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-xredprine10
1 files changed, 6 insertions, 4 deletions
diff --git a/redprine b/redprine
index a9b89eb..2c2d055 100755
--- a/redprine
+++ b/redprine
@@ -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"
}