|  | 
|  | 1 | +#!/usr/bin/env bash | 
|  | 2 | +# | 
|  | 3 | +#  Nextcloud Android Library is available under MIT license | 
|  | 4 | +# | 
|  | 5 | +#  @author Álvaro Brey Vilas | 
|  | 6 | +#  Copyright (C) 2022 Álvaro Brey Vilas | 
|  | 7 | +#  Copyright (C) 2022 Nextcloud GmbH | 
|  | 8 | +# | 
|  | 9 | +#  Permission is hereby granted, free of charge, to any person obtaining a copy | 
|  | 10 | +#  of this software and associated documentation files (the "Software"), to deal | 
|  | 11 | +#  in the Software without restriction, including without limitation the rights | 
|  | 12 | +#  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | 
|  | 13 | +#  copies of the Software, and to permit persons to whom the Software is | 
|  | 14 | +#  furnished to do so, subject to the following conditions: | 
|  | 15 | +# | 
|  | 16 | +#  The above copyright notice and this permission notice shall be included in | 
|  | 17 | +#  all copies or substantial portions of the Software. | 
|  | 18 | +# | 
|  | 19 | +#  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | 
|  | 20 | +#  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | 
|  | 21 | +#  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | 
|  | 22 | +#  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS | 
|  | 23 | +#  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 
|  | 24 | +#  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | 
|  | 25 | +#  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | 
|  | 26 | +#  THE SOFTWARE. | 
|  | 27 | +# | 
|  | 28 | + | 
|  | 29 | +## This file is intended to be sourced by other scripts | 
|  | 30 | + | 
|  | 31 | + | 
|  | 32 | +function err() { | 
|  | 33 | +    echo >&2 "$@" | 
|  | 34 | +} | 
|  | 35 | + | 
|  | 36 | + | 
|  | 37 | +function curl_gh() { | 
|  | 38 | +    if [[ -n "$GITHUB_TOKEN" ]] | 
|  | 39 | +    then | 
|  | 40 | +        curl \ | 
|  | 41 | +            --silent \ | 
|  | 42 | +            --header "Authorization: token $GITHUB_TOKEN" \ | 
|  | 43 | +            "$@" | 
|  | 44 | +    else | 
|  | 45 | +        err "WARNING: No GITHUB_TOKEN found. Skipping API call" | 
|  | 46 | +    fi | 
|  | 47 | + | 
|  | 48 | +} | 
0 commit comments