Skip to content

Commit

Permalink
fix script to work with new api that downcases things
Browse files Browse the repository at this point in the history
  • Loading branch information
btorres committed Jun 5, 2018
1 parent 12aa041 commit 7770768
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions gitlab.bash
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ function __mass_gitlab_utils_generate_request() {
}

function __mass_gitlab_utils_get_last_pagination_page_of_object() {
paginated_object=$1
# gitlab apis are paginated. Grab the first page of an object and extract the "last" page number
object_pages=$(__mass_gitlab_utils_generate_request "GET" "${paginated_object}" "-I" \?per_page=100 | egrep "X-Total-Pages")
object_pages=$(__mass_gitlab_utils_generate_request "GET" "${paginated_object}" "-I" \?per_page=100)

# Regex to match the "last page"
regex_pattern='X-Total-Pages: ([0-9]+)'
regex_pattern='x-total-pages: ([0-9]+)'
[[ ${object_pages[@]} =~ $regex_pattern ]]
# Grab the "last page"
[[ $object_pages =~ $regex_pattern ]]
Expand Down

0 comments on commit 7770768

Please sign in to comment.