-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat (GitHub): Inspect repo and PR contents without having to clone the repo #967
Comments
I think this would be useful for me as well. If we only care about Terraform-related changes would we need to inspect the atlantis.yaml file? If not, I think this could be a straightforward change since it looks like Atlantis already uses the PR API to find the modified files prior to cloning the PR. I could take a shot at this, maybe making this an optional behavior we can enable with a flag. |
My main reason for needing to read the |
Hey @lkysow. We do use org-wide webhooks, but with thousands of repositories, the blacklist patterns often aren't sufficient. The main catalyst for this issue was a large repository (10GB+) with Terraform code in it. If a non-Terraform change is made, we don't want Atlantis to bother with cloning the repo, you know, because it's huge. Edit: After looking at #221, it is indeed a similar problem we are trying to solve. I might even go so far as to call this issue a duplicate. |
Gotcha. Yeah I think we need to do the exploratory API calls that you've linked in the issue. |
Something I've noticed that seems related to this is that PRs that get merged quickly enough after opening generate a message from atlantis saying "Plan Error" with a backtrace of the git clone failing:
This can be confusing when the changes weren't terraform related. |
This will be available in the next release via the |
GitHub has two API endpoints that should allow us to only clone repos when there are Terraform-related changes in the PR.
APIs
atlantis.yaml
without cloning the repoExamples
This should only require two API calls after receiving a webhook.
Fetch the atlantis.yaml from the repo
GET /repos/example-owner/example-repo/atlantis.yaml
This returns a file object that contains the file contents as a base64-encoded string:
Get a list of files modified in a PR
GET /repos/example-owner/example-repo/pulls/100/files
This returns a list of file objects:
References
The text was updated successfully, but these errors were encountered: