From 0eb52f384a83560a39131bb4b858514c64a4e0c3 Mon Sep 17 00:00:00 2001 From: giovaq Date: Tue, 18 Aug 2026 20:58:58 +0400 Subject: [PATCH 1/3] updated description --- .github-api-integration-module.sh.un~ | Bin 0 -> 947 bytes github-api-integration-module.sh | 1 + github-api-integration-module.sh~ | 48 ++++++++++++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 .github-api-integration-module.sh.un~ create mode 100644 github-api-integration-module.sh~ diff --git a/.github-api-integration-module.sh.un~ b/.github-api-integration-module.sh.un~ new file mode 100644 index 0000000000000000000000000000000000000000..b624cf4b7ceef5bc0f35c88787fa51bd123b7c4d GIT binary patch literal 947 zcmWH`%$*;a=aT=Ffk`m~9xL*#;g@Y(N`9`3@X4 Jrj5^60RWk1D!~8% literal 0 HcmV?d00001 diff --git a/github-api-integration-module.sh b/github-api-integration-module.sh index d94d2951..497e49dc 100644 --- a/github-api-integration-module.sh +++ b/github-api-integration-module.sh @@ -5,6 +5,7 @@ # # # +# # This script will help users to communicate and retrieve information from GitHub # Usage: # Please provide your github token and rest api to the script as input diff --git a/github-api-integration-module.sh~ b/github-api-integration-module.sh~ new file mode 100644 index 00000000..d94d2951 --- /dev/null +++ b/github-api-integration-module.sh~ @@ -0,0 +1,48 @@ +#!/bin/bash +################################ +# Author: Abhishek +# Version: v1 +# +# +# +# This script will help users to communicate and retrieve information from GitHub +# Usage: +# Please provide your github token and rest api to the script as input +# +# +################################ + +if [ ${#@} -lt 2 ]; then + echo "usage: $0 [your github token] [REST expression]" + exit 1; +fi + +GITHUB_TOKEN=$1 +GITHUB_API_REST=$2 + +GITHUB_API_HEADER_ACCEPT="Accept: application/vnd.github.v3+json" + +temp=`basename $0` +TMPFILE=`mktemp /tmp/${temp}.XXXXXX` || exit 1 + + +function rest_call { + curl -s $1 -H "${GITHUB_API_HEADER_ACCEPT}" -H "Authorization: token $GITHUB_TOKEN" >> $TMPFILE +} + +# single page result-s (no pagination), have no Link: section, the grep result is empty +last_page=`curl -s -I "https://api.github.com${GITHUB_API_REST}" -H "${GITHUB_API_HEADER_ACCEPT}" -H "Authorization: token $GITHUB_TOKEN" | grep '^Link:' | sed -e 's/^Link:.*page=//g' -e 's/>.*$//g'` + +# does this result use pagination? +if [ -z "$last_page" ]; then + # no - this result has only one page + rest_call "https://api.github.com${GITHUB_API_REST}" +else + + # yes - this result is on multiple pages + for p in `seq 1 $last_page`; do + rest_call "https://api.github.com${GITHUB_API_REST}?page=$p" + done +fi + +cat $TMPFILE From 1ef7b3a2660ef19ce27613eeaecf02c8ea75a577 Mon Sep 17 00:00:00 2001 From: giorgivaqiashvili Date: Tue, 18 Aug 2026 22:35:22 +0400 Subject: [PATCH 2/3] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c6345487..5070538a 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ # Shell -Schell Scripts +Schell Scripts for rreference From 81c30b2f12f8845c6efcc258aab37399e4c044f0 Mon Sep 17 00:00:00 2001 From: giorgivaqiashvili Date: Tue, 18 Aug 2026 23:17:36 +0400 Subject: [PATCH 3/3] Create test.sh --- test.sh | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 test.sh diff --git a/test.sh b/test.sh new file mode 100644 index 00000000..a10b090b --- /dev/null +++ b/test.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +echo "Adding unit tests"