Skip to main content

signaloid-cli github connect

Create or update GitHub integration.

Synopsis​

signaloid-cli github connect --token <code> [options]

Description​

Creates or updates the GitHub integration for your Signaloid account. This connects your GitHub account to Signaloid, enabling access to your private repositories and automated builds.

The integration uses GitHub's OAuth flow. The value passed to --token is the OAuth authorization code that GitHub hands back at the end of that flow and not a Personal Access Token. Signaloid exchanges the code for an access token server-side. The access token itself is never handled by the signaloid-cli.

Options​

OptionDescription
--token <code>GitHub OAuth authorization code (required)
--user-id <id>User ID (defaults to current user, requires admin for others)

Obtaining an authorization code​

Authorization codes are short-lived and single-use. Start the GitHub integration flow from the Signaloid Cloud Platform account settings, authorize the Signaloid application, and GitHub redirects back with a code query parameter. That value is what --token expects.

If the code has already been used or has expired, re-run the authorization flow to obtain a fresh one.

Output​

Returns the integration details:

{
"UserID": "usr_12345661ad6641899387b6458cc9a2e2",
"GithubUsername": "myusername",
"Connected": true,
"ConnectedAt": "2025-01-20T10:30:00Z",
"Message": "GitHub connected/updated"
}

Examples​

Connect GitHub Account​

signaloid-cli github connect --token "$GITHUB_OAUTH_CODE"

Connect on Behalf of Another User​

Requires administrator privileges:

signaloid-cli github connect \
--token "$GITHUB_OAUTH_CODE" \
--user-id usr_12345661ad6641899387b6458cc9a2e2

Connect with Validation​

#!/bin/bash

GH_CODE="$1"

if [ -z "$GH_CODE" ]; then
echo "Usage: $0 <github-oauth-code>"
exit 1
fi

# Connect
echo "Connecting GitHub account..."
if ! signaloid-cli github connect --token "$GH_CODE"; then
echo "Failed to connect GitHub"
exit 1
fi

# Validate by listing repos
echo "Validating connection..."
if REPOS=$(signaloid-cli github repos 2>&1); then
REPO_COUNT=$(echo "$REPOS" | jq '. | length')
echo "Success! Found $REPO_COUNT accessible repositories"
else
echo "Warning: Connected but unable to list repositories"
exit 1
fi

Exit Codes​

CodeDescription
0Success
1Failed to connect/update GitHub (invalid or expired code, API error)
3Not authenticated to Signaloid, or the session has expired
4User not found

Security Best Practices​

Never Hardcode the Code​

Authorization codes are credentials, even though they are short-lived:

# ❌ Bad - code in script
signaloid-cli github connect --token 1a2b3c4d5e6f...

# ✅ Good - code from environment
signaloid-cli github connect --token "$GITHUB_OAUTH_CODE"

Troubleshooting​

Invalid or Expired Code​

✖ Failed to connect/update GitHub

Solution: Authorization codes expire quickly and can only be redeemed once. Re-run the GitHub authorization flow and connect again with the new code.

Connected but Repositories Not Visible​

Solution: Confirm you granted the Signaloid GitHub application access to the organizations or repositories you expect. Re-run the authorization flow and adjust the repository access grant.

See Also​