From a301afc7af290c56e3a4359e6739be3b7b5e9164 Mon Sep 17 00:00:00 2001 From: Josh Johanning Date: Tue, 21 Oct 2025 09:06:52 -0500 Subject: [PATCH 1/7] feat: add script to retrieve organization databaseId for VNet injection --- gh-cli/README.md | 13 ++++++++++++ .../get-organization-database-id-for-vnet.sh | 21 +++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100755 gh-cli/get-organization-database-id-for-vnet.sh diff --git a/gh-cli/README.md b/gh-cli/README.md index e17fcf0..31b128a 100644 --- a/gh-cli/README.md +++ b/gh-cli/README.md @@ -931,6 +931,19 @@ The list will contain the repository name, source (CODEOWNERS file), and kind of Repositories with no CODEONWERS files or CODEOWNERS errors will not be listed. +### get-organization-database-id-for-vnet.sh + +Retrieves the databaseId of an organization for use with VNet injection configuration. + +Usage: + +```shell +./get-organization-databaseId-for-vnet.sh +``` + +> [!NOTE] +> See [Configuring private networking for GitHub-hosted runners in your organization](https://docs.github.com/en/organizations/managing-organization-settings/configuring-private-networking-for-github-hosted-runners-in-your-organization#1-obtain-the-databaseid-for-your-organization) for more information on using the databaseId with VNet injection + ### get-organization-id.sh Get the organization ID used for other GraphQL calls. Use the login of the Organization as the input. diff --git a/gh-cli/get-organization-database-id-for-vnet.sh b/gh-cli/get-organization-database-id-for-vnet.sh new file mode 100755 index 0000000..fb793bf --- /dev/null +++ b/gh-cli/get-organization-database-id-for-vnet.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# This script retrieves the databaseId of your organization to be used in the Vnet injection scripts +# https://docs.github.com/en/organizations/managing-organization-settings/configuring-private-networking-for-github-hosted-runners-in-your-organization#1-obtain-the-databaseid-for-your-organization + +if [ -z "$1" ]; then + echo "Usage: $0 " + echo "Example: ./get-enterprise-id.sh joshjohanning-org" + exit 1 +fi + +org="$1" + +gh api graphql -f organization="$org" -f query=' +query ($organization: String!) + { organization(login: $organization) { + login + databaseId + } +} +' From c5cf790d8b0f7b15a27c051b414312ded1e7f750 Mon Sep 17 00:00:00 2001 From: Josh Johanning Date: Tue, 21 Oct 2025 09:29:53 -0500 Subject: [PATCH 2/7] fix: update example Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- gh-cli/get-organization-database-id-for-vnet.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gh-cli/get-organization-database-id-for-vnet.sh b/gh-cli/get-organization-database-id-for-vnet.sh index fb793bf..e4ee068 100755 --- a/gh-cli/get-organization-database-id-for-vnet.sh +++ b/gh-cli/get-organization-database-id-for-vnet.sh @@ -5,7 +5,7 @@ if [ -z "$1" ]; then echo "Usage: $0 " - echo "Example: ./get-enterprise-id.sh joshjohanning-org" + echo "Example: ./get-organization-database-id-for-vnet.sh joshjohanning-org" exit 1 fi From 1fff183c7cf496054c3e4994555335634d353d5f Mon Sep 17 00:00:00 2001 From: Josh Johanning Date: Tue, 21 Oct 2025 09:30:08 -0500 Subject: [PATCH 3/7] fix: correct example usage in get-organization-id.sh --- gh-cli/get-organization-id.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gh-cli/get-organization-id.sh b/gh-cli/get-organization-id.sh index 2347684..51d9371 100755 --- a/gh-cli/get-organization-id.sh +++ b/gh-cli/get-organization-id.sh @@ -2,7 +2,7 @@ if [ -z "$1" ]; then echo "Usage: $0 " - echo "Example: ./get-enterprise-id.sh joshjohanning-org" + echo "Example: ./get-organization-id.sh joshjohanning-org" exit 1 fi From a2746e5b85f573f8f1595a9adf304fd5e14ba7cc Mon Sep 17 00:00:00 2001 From: Josh Johanning Date: Tue, 21 Oct 2025 09:31:16 -0500 Subject: [PATCH 4/7] fix: add missing header for GitHub API request in get-organization-database-id-for-vnet.sh --- gh-cli/get-organization-database-id-for-vnet.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gh-cli/get-organization-database-id-for-vnet.sh b/gh-cli/get-organization-database-id-for-vnet.sh index e4ee068..fe8ca5e 100755 --- a/gh-cli/get-organization-database-id-for-vnet.sh +++ b/gh-cli/get-organization-database-id-for-vnet.sh @@ -11,7 +11,7 @@ fi org="$1" -gh api graphql -f organization="$org" -f query=' +gh api graphql -H X-Github-Next-Global-ID:1 -f organization="$org" -f query=' query ($organization: String!) { organization(login: $organization) { login From 3cb50901e72a37ebc02ba39ccddff84e1079d78b Mon Sep 17 00:00:00 2001 From: Josh Johanning Date: Tue, 21 Oct 2025 09:31:40 -0500 Subject: [PATCH 5/7] docs: fix script name Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- gh-cli/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gh-cli/README.md b/gh-cli/README.md index 31b128a..6d79f60 100644 --- a/gh-cli/README.md +++ b/gh-cli/README.md @@ -938,7 +938,7 @@ Retrieves the databaseId of an organization for use with VNet injection configur Usage: ```shell -./get-organization-databaseId-for-vnet.sh +./get-organization-database-id-for-vnet.sh ``` > [!NOTE] From b0ab2c30966191c9e34dba66721eeaecf0e512d1 Mon Sep 17 00:00:00 2001 From: Josh Johanning Date: Tue, 21 Oct 2025 09:33:45 -0500 Subject: [PATCH 6/7] docs: update script description Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- gh-cli/get-organization-database-id-for-vnet.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gh-cli/get-organization-database-id-for-vnet.sh b/gh-cli/get-organization-database-id-for-vnet.sh index fe8ca5e..be91aed 100755 --- a/gh-cli/get-organization-database-id-for-vnet.sh +++ b/gh-cli/get-organization-database-id-for-vnet.sh @@ -1,6 +1,6 @@ #!/bin/bash -# This script retrieves the databaseId of your organization to be used in the Vnet injection scripts +# This script retrieves the databaseId of your organization to be used in the VNet injection scripts # https://docs.github.com/en/organizations/managing-organization-settings/configuring-private-networking-for-github-hosted-runners-in-your-organization#1-obtain-the-databaseid-for-your-organization if [ -z "$1" ]; then From 273ef314681a47948743889c1f26abc00221ecc2 Mon Sep 17 00:00:00 2001 From: Josh Johanning Date: Tue, 21 Oct 2025 09:49:24 -0500 Subject: [PATCH 7/7] fix: remove trailing spaces in GraphQL queries --- gh-cli/get-organization-database-id-for-vnet.sh | 2 +- gh-cli/get-organization-id.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gh-cli/get-organization-database-id-for-vnet.sh b/gh-cli/get-organization-database-id-for-vnet.sh index be91aed..f101ed7 100755 --- a/gh-cli/get-organization-database-id-for-vnet.sh +++ b/gh-cli/get-organization-database-id-for-vnet.sh @@ -15,7 +15,7 @@ gh api graphql -H X-Github-Next-Global-ID:1 -f organization="$org" -f query=' query ($organization: String!) { organization(login: $organization) { login - databaseId + databaseId } } ' diff --git a/gh-cli/get-organization-id.sh b/gh-cli/get-organization-id.sh index 51d9371..0b177d4 100755 --- a/gh-cli/get-organization-id.sh +++ b/gh-cli/get-organization-id.sh @@ -14,7 +14,7 @@ query ($organization: String!) { organization(login: $organization) { login name - id + id } } '