From a97e240fdd18a2e9212fb0ab89e7b301f487b4b4 Mon Sep 17 00:00:00 2001 From: sri hari Date: Sat, 21 Feb 2026 23:47:27 +0530 Subject: [PATCH 1/3] added ok srihari --- github-api-integration-module.sh | 96 ++++++++++++++++---------------- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/github-api-integration-module.sh b/github-api-integration-module.sh index d94d2951..e2543774 100644 --- a/github-api-integration-module.sh +++ b/github-api-integration-module.sh @@ -1,48 +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 +#!/bin/bash +################################ +# Author: Abhishek +# Version: v1 +# +# +# +# This script will help users to communicate and retrieve information from GitHub ok srihari +# 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 ec9554113cb386c9ce9a6914b45ff48d1e30fa42 Mon Sep 17 00:00:00 2001 From: yarrapathruni-srihari <142422458+yarrapathruni-srihari@users.noreply.github.com> Date: Sun, 22 Feb 2026 20:21:54 +0530 Subject: [PATCH 2/3] Update github-api-integration-module.sh --- github-api-integration-module.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/github-api-integration-module.sh b/github-api-integration-module.sh index e2543774..d47484f2 100644 --- a/github-api-integration-module.sh +++ b/github-api-integration-module.sh @@ -5,7 +5,7 @@ # # # -# This script will help users to communicate and retrieve information from GitHub ok srihari +# This script will help users to communicate and retrieve information from GitHub ok srihari # Usage: # Please provide your github token and rest api to the script as input # @@ -46,3 +46,4 @@ else fi cat $TMPFILE + From 8835cb9c3b1129311b4866adf5737215edee0609 Mon Sep 17 00:00:00 2001 From: yarrapathruni-srihari <142422458+yarrapathruni-srihari@users.noreply.github.com> Date: Sun, 22 Feb 2026 20:23:42 +0530 Subject: [PATCH 3/3] Update github-api-integration-module.sh --- github-api-integration-module.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/github-api-integration-module.sh b/github-api-integration-module.sh index d47484f2..491fecd3 100644 --- a/github-api-integration-module.sh +++ b/github-api-integration-module.sh @@ -5,7 +5,7 @@ # # # -# This script will help users to communicate and retrieve information from GitHub ok srihari +# This script will help users to communicate and retrieve information from GitHub ok srihari fetch # Usage: # Please provide your github token and rest api to the script as input # @@ -47,3 +47,4 @@ fi cat $TMPFILE +