CheckRepositoryAccess
client.Runners.CheckRepositoryAccess(ctx, body) (*RunnerCheckRepositoryAccessResponse, error)
POST/gitpod.v1.RunnerService/CheckRepositoryAccess
Checks if a principal has read access to a repository.
Use this method to:
- Validate repository access before workflow execution
- Verify executor credentials for automation bindings
Returns:
- has_access: true if the principal can read the repository
- FAILED_PRECONDITION if authentication is required
- INVALID_ARGUMENT if the repository URL is invalid
Examples
-
Check access:
Verifies read access to a repository.
runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" repositoryUrl: "https://github.com/org/repo"
CheckRepositoryAccess
package main
import (
"context"
"fmt"
"github.com/gitpod-io/gitpod-sdk-go"
"github.com/gitpod-io/gitpod-sdk-go/option"
)
func main() {
client := gitpod.NewClient(
option.WithBearerToken("My Bearer Token"),
)
response, err := client.Runners.CheckRepositoryAccess(context.TODO(), gitpod.RunnerCheckRepositoryAccessParams{
RepositoryURL: gitpod.F("https://github.com/org/repo"),
RunnerID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.ErrorMessage)
}
{
"errorMessage": "errorMessage",
"hasAccess": true
}Returns Examples
{
"errorMessage": "errorMessage",
"hasAccess": true
}