From fd1fa78ab97c8196861173b888745f285ede074e Mon Sep 17 00:00:00 2001 From: Aru778 Date: Tue, 27 Jan 2026 10:44:24 +0530 Subject: [PATCH 1/3] chore: updates description --- github-api-intergration-module.sh | 49 +++++++++++++++++++++++++++++++ updateDescription | 49 +++++++++++++++++++++++++++++++ 2 files changed, 98 insertions(+) create mode 100644 github-api-intergration-module.sh create mode 100644 updateDescription diff --git a/github-api-intergration-module.sh b/github-api-intergration-module.sh new file mode 100644 index 00000000..a97e2f09 --- /dev/null +++ b/github-api-intergration-module.sh @@ -0,0 +1,49 @@ +#!/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 diff --git a/updateDescription b/updateDescription new file mode 100644 index 00000000..a97e2f09 --- /dev/null +++ b/updateDescription @@ -0,0 +1,49 @@ +#!/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 f4e597a2e969dfe2acfde32b0cd3bd5aedf6ae5b Mon Sep 17 00:00:00 2001 From: Aru778 <40577253+Aru778@users.noreply.github.com> Date: Wed, 28 Jan 2026 12:37:08 +0530 Subject: [PATCH 2/3] Update README to clarify Shell Scripts section --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c6345487..9de3095c 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ # Shell -Schell Scripts +Schell Scripts for reference From 55f576d79c3c2d0523dbdc46641ac2441e9a165f Mon Sep 17 00:00:00 2001 From: Aru778 <40577253+Aru778@users.noreply.github.com> Date: Wed, 28 Jan 2026 12:44:07 +0530 Subject: [PATCH 3/3] Update README to clarify purpose of Shell scripts --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9de3095c..af69ee0c 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ # Shell -Schell Scripts for reference +Schell Scripts for reference and practice.