Skip to content

Commit 9cff539

Browse files
committed
fix: update usage instructions and parameter names in create-app-jwt.sh
1 parent 8c61cef commit 9cff539

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

scripts/create-app-jwt.sh

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,16 @@
44
# Script to create a JWT (JSON Web Token) signed with a private RSA key.
55
#
66
# Usage:
7-
# ./create-app-jwt.sh <client_id> <private_key_file>
7+
# ./create-app-jwt.sh <app_id_or_client_id> <private_key_file>
88
#
99
# Arguments:
10-
# <client_id> The client ID to use as the JWT issuer (iss).
11-
# <private_key_file> Path to the PEM-encoded RSA private key file.
10+
# <app_id_or_client_id> The GitHub App ID (integer) or Client ID (Iv1.xxx)
11+
# to use as the JWT issuer (iss). Both work.
12+
# <private_key_file> Path to the PEM-encoded RSA private key file.
1213
#
1314
# Example:
14-
# ./create-app-jwt.sh my-client-id /path/to/private-key.pem
15+
# ./create-app-jwt.sh 123456 /path/to/private-key.pem
16+
# ./create-app-jwt.sh Iv1.abc123def456 /path/to/private-key.pem
1517
#
1618
# The script outputs the generated JWT to stdout.
1719
# -----------------------------------------------------------------------------
@@ -20,11 +22,11 @@ set -o pipefail
2022
# Input validation for required parameters
2123
if [ -z "$1" ] || [ -z "$2" ]; then
2224
echo "Error: Missing required parameters." >&2
23-
echo "Usage: $0 <client_id> <path_to_private_key_pem>" >&2
25+
echo "Usage: $0 <app_id_or_client_id> <path_to_private_key_pem>" >&2
2426
exit 1
2527
fi
2628

27-
client_id=$1 # Client ID as first argument
29+
app_id_or_client_id=$1 # App ID (integer) or Client ID (Iv1.xxx) - both work
2830

2931
# Check if the private key file exists and is readable
3032
if [ ! -f "$2" ] || [ ! -r "$2" ]; then
@@ -49,7 +51,7 @@ header=$( echo -n "${header_json}" | b64enc )
4951
payload_json="{
5052
\"iat\":${iat},
5153
\"exp\":${exp},
52-
\"iss\":\"${client_id}\"
54+
\"iss\":\"${app_id_or_client_id}\"
5355
}"
5456
# Payload encode
5557
payload=$( echo -n "${payload_json}" | b64enc )

0 commit comments

Comments
 (0)