You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: api/README.md
+13Lines changed: 13 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,9 @@
1
1
# api
2
2
3
+
## checking-github-app-rate-limits.sh
4
+
5
+
This script checks the GitHub App's rate limit status by generating a JWT (JSON Web Token), obtaining an installation access token, and then querying the GitHub API for the rate limit information. It is useful for developers and administrators to monitor and manage their GitHub App's API usage.
6
+
3
7
## create-repo.sh
4
8
5
9
Create an internal repo in an organization
@@ -37,3 +41,12 @@ Download a workflow artifact (e.g.: downloading the artifact from the build work
37
41
Enables actions on a repository - similar to [gh cli example](./../api/enable-actions-on-repository.sh), but using `curl`
This script generates a JWT (JSON Web Token) for a GitHub App and uses it to list the installations of the App. It is useful for developers and administrators who need to authenticate as a GitHub App to access GitHub API.
This script is designed to generate a JWT (JSON Web Token) for authenticating as a GitHub App. It then uses this token to perform GitHub API requests, specifically to retrieve information about a specified repository
52
+
and display the current API rate limit status. This is particularly useful for developers and administrators who need to monitor their GitHub App's API usage and ensure it stays within the GitHub API rate limits.
# - The script requires `openssl` to generate the JWT and `curl` to make API requests.
25
+
# - The JWT generated by this script is valid for 10 minutes from its creation time.
26
+
# - Debug mode can be enabled to output detailed information about each step of the JWT creation and API request process.
27
+
# - Ensure that the private key file path is correct and the file has appropriate read permissions.
28
+
# - The script is intended for use with GitHub Apps and requires the APP_ID, PRIVATE_KEY_PATH, ORG_NAME, REPO_NAME, and INSTALLATION_ID to function correctly.
29
+
30
+
# Initialize debug mode to off
31
+
DEBUG_MODE=0
32
+
33
+
# Function to handle debug messages
34
+
debug() {
35
+
if [ "$DEBUG_MODE"-eq 1 ];then
36
+
echo"DEBUG: $*"
37
+
fi
38
+
}
39
+
40
+
# Initialize an array to hold the remaining arguments after removing recognized flags
41
+
REMAINING_ARGS=()
42
+
43
+
# Process each argument
44
+
while [ "$#"-gt 0 ];do
45
+
case"$1"in
46
+
--debug)
47
+
DEBUG_MODE=1
48
+
shift# Remove --debug from the list of arguments
49
+
;;
50
+
*)
51
+
# Collect unrecognized arguments
52
+
REMAINING_ARGS+=("$1")
53
+
shift# Move to the next argument
54
+
;;
55
+
esac
56
+
done
57
+
58
+
# Check if we have at least four remaining arguments for APP_ID, PRIVATE_KEY_PATH, ORG_NAME, and REPO_NAME
0 commit comments