Open gregnrobinson opened 7 months ago
Thanks we have the same bug too and we are using GitHub SaaS.
{"level":50,"time":1715657742292,"pid":24,"hostname":"release-name-safe-settings-755548ff8b-mwg9l","name":"probot","name":"probot","msg":"Error HttpError: Resource not accessible by integration in Environments for repo: {\"owner\":\"xxxxxx\",\"repo\":\"xxxxxx\"} entries [{\"name\":\"production\",\"wait_timer\":0,\"prevent_self_review\":true,\"reviewers\":[{\"type\":\"Team\",\"id\":xxxxxx}],\"deployment_branch_policy\":null},{\"name\":\"qa\",\"wait_timer\":0,\"prevent_self_review\":false,\"reviewers\":[{\"type\":\"Team\",\"id\":xxxxxx}],\"deployment_branch_policy\":null}]"}
The error is fixed after granting Actions read permission to the app. This is the requirement for using this listing endpoint.
https://docs.github.com/en/rest/deployments/environments?apiVersion=2022-11-28#list-environments
The fine-grained token must have the following permission set: "Actions" repository permissions (read)
Problem Description
When managing environments with safe settings, if the repository is set to public, safe settings will create all environments defined within the suborg configuration. If the repository visibility is set to private or internal, safe settings presents an error even though the provisioning of environments has been tested for all repository visibilities via the REST API.
What is actually happening
If the repositories are anything but public visibility, safe settings cannot provision the environments.
What is the expected behavior
Safe Settings should be able to manage environments on repositories that are set to private or internal visibility.
Error output, if available
Context
We had initially opened #611 regarding environment provisioning but assumed the issue was due to insufficient licensing for the non-prod environments but after deploying to production, the environment provisioning would still only work for public repositories. Using the REST API, we can successfully create environments for repositories even if the repository is set internal or private visibility. We are wondering why Safe settings specifically returns an error for environments that are being provisioned against internal or private repositories.
Create environment for a public repository
response
Create an environment for an internal repository
response
Create an environment for a private repository
response
Environments suborg configuration
Are you using the hosted instance of probot/settings or running your own?
Running safe settings on AKS with ingress for webhook.
If running your own instance, are you using it with github.com or GitHub Enterprise?
GitHub Enterprise Server
Version of probot/settings
Running Probot v12.3.3 (Node.js: v16.20.2)
Version of GitHub Enterprise
GitHub Enterprise Server 3.11