Skip to content
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

fix: Enable --skip-clone-no-changes for fork PRs (#3891) #3900

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

Ulminator
Copy link

@Ulminator Ulminator commented Oct 25, 2023

what

This PR performs a check on whether the Atlantis PR is from a forked repo or not before making the call to GetFileContent to fetch the repo level atlantis.yaml file.

why

While working in a monorepo that others would fork, the disk space on the VM that Atlantis runs on was quickly filled up as every PR made would be cloned. This should not happen when the --skip-clone-no-changes flag is used, but the logic for that currently ignores fork PRs.

tests

  • I have tested my changes by ...

I have deployed my branch and validated that PRs from forked repos are not cloned if the files changed in them are outside project directories.

make test passed as well.

Our workflow only uses the GitHub client so the implementation of the GitLab client has not been tested.

references

@jamengual
Copy link
Contributor

@Ulminator
Copy link
Author

I did not, but I was able to confirm that hasRepoCfg is always false for fork PRs. Since that is the case a clone will always performed, which seems to contradict the docs for --skip-clone-no-changes.

Can you elaborate on how --checkout-depth would help? I believe regardless of the --checkout-strategy/depth there would be many git clone invocations that could be avoided with this PR, but maybe I am missing something.

@jamengual
Copy link
Contributor

I did not, but I was able to confirm that hasRepoCfg is always false for fork PRs. Since that is the case a clone will always performed, which seems to contradict the docs for --skip-clone-no-changes.

Can you elaborate on how --checkout-depth would help? I believe regardless of the --checkout-strategy/depth there would be many git clone invocations that could be avoided with this PR, but maybe I am missing something.

I thought your concern was the size of the clone and not the amount of git clone invocations

@Ulminator
Copy link
Author

I did not, but I was able to confirm that hasRepoCfg is always false for fork PRs. Since that is the case a clone will always performed, which seems to contradict the docs for --skip-clone-no-changes.
Can you elaborate on how --checkout-depth would help? I believe regardless of the --checkout-strategy/depth there would be many git clone invocations that could be avoided with this PR, but maybe I am missing something.

I thought your concern was the size of the clone and not the amount of git clone invocations

The size is not an issue if --skip-clone-no-changes actually skips the cloning of a forked PR when there are no changes. Those invocations are just not necessary to be performed so if they can be avoided why not?

Without this change the call to GetFileContent searches for the feature branch on the base repo, but it exists on the head repo so it always has the 404 status from GitHub.

Since deploying this branch yesterday, many forked PRs have skipped the cloning flow:

Logs
# cat $LOG_FILE | grep clone
{"level":"info","ts":"2023-10-25T23:31:19.114Z","caller":"events/project_command_builder.go:373","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38868"}}
{"level":"info","ts":"2023-10-25T23:52:52.236Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38823"}}
{"level":"info","ts":"2023-10-25T23:59:12.414Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38868"}}
{"level":"info","ts":"2023-10-26T00:01:20.135Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38868"}}
{"level":"info","ts":"2023-10-26T01:24:41.327Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38967"}}
{"level":"info","ts":"2023-10-26T02:10:46.179Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38789"}}
{"level":"info","ts":"2023-10-26T03:59:33.838Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38876"}}
{"level":"info","ts":"2023-10-26T09:19:26.205Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38968"}}
{"level":"info","ts":"2023-10-26T13:34:54.276Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38890"}}
{"level":"info","ts":"2023-10-26T14:00:14.383Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38890"}}
{"level":"info","ts":"2023-10-26T14:01:29.206Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38681"}}
{"level":"info","ts":"2023-10-26T14:09:26.666Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38893"}}
{"level":"info","ts":"2023-10-26T14:13:53.161Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"37073"}}
{"level":"info","ts":"2023-10-26T14:14:47.840Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38893"}}
{"level":"info","ts":"2023-10-26T14:16:21.873Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38833"}}
{"level":"info","ts":"2023-10-26T14:20:15.507Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38785"}}
{"level":"info","ts":"2023-10-26T14:22:54.801Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38969"}}
{"level":"info","ts":"2023-10-26T14:31:20.756Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38893"}}
{"level":"info","ts":"2023-10-26T14:31:41.260Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38848"}}
{"level":"info","ts":"2023-10-26T14:44:20.078Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38969"}}
{"level":"info","ts":"2023-10-26T14:45:28.691Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38885"}}
{"level":"info","ts":"2023-10-26T14:54:23.871Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38970"}}
{"level":"info","ts":"2023-10-26T14:59:53.842Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38884"}}
{"level":"info","ts":"2023-10-26T15:02:12.293Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38890"}}
{"level":"info","ts":"2023-10-26T15:08:11.103Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38823"}}
{"level":"info","ts":"2023-10-26T15:09:42.291Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38897"}}
{"level":"info","ts":"2023-10-26T15:10:41.639Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38785"}}
{"level":"info","ts":"2023-10-26T15:16:42.167Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38848"}}
{"level":"info","ts":"2023-10-26T15:24:45.334Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38890"}}
{"level":"info","ts":"2023-10-26T15:25:52.467Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38526"}}
{"level":"info","ts":"2023-10-26T15:28:22.170Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38893"}}
{"level":"info","ts":"2023-10-26T15:32:44.171Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38848"}}
{"level":"info","ts":"2023-10-26T15:37:20.356Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38833"}}
{"level":"info","ts":"2023-10-26T15:38:49.340Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38681"}}
{"level":"info","ts":"2023-10-26T15:40:07.060Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38888"}}
{"level":"info","ts":"2023-10-26T15:41:36.969Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38885"}}
{"level":"info","ts":"2023-10-26T15:42:01.283Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38885"}}
{"level":"info","ts":"2023-10-26T15:44:47.232Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38885"}}
{"level":"info","ts":"2023-10-26T15:49:12.869Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38884"}}
{"level":"info","ts":"2023-10-26T15:54:27.534Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38965"}}
{"level":"info","ts":"2023-10-26T15:55:23.129Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38965"}}
{"level":"info","ts":"2023-10-26T15:58:38.310Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38965"}}
{"level":"info","ts":"2023-10-26T16:09:19.461Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38971"}}
{"level":"info","ts":"2023-10-26T16:12:09.505Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38972"}}
{"level":"info","ts":"2023-10-26T16:16:42.809Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"37073"}}
{"level":"info","ts":"2023-10-26T16:23:11.559Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38893"}}
{"level":"info","ts":"2023-10-26T16:23:15.545Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38972"}}
{"level":"info","ts":"2023-10-26T16:30:47.955Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38688"}}
{"level":"info","ts":"2023-10-26T16:36:04.822Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38971"}}
{"level":"info","ts":"2023-10-26T16:36:31.320Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38973"}}
{"level":"info","ts":"2023-10-26T16:36:45.927Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38896"}}
{"level":"info","ts":"2023-10-26T16:38:54.884Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38823"}}
{"level":"info","ts":"2023-10-26T16:39:32.184Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38789"}}
{"level":"info","ts":"2023-10-26T16:41:59.160Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38879"}}
{"level":"info","ts":"2023-10-26T16:49:53.400Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38855"}}
{"level":"info","ts":"2023-10-26T16:53:25.597Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38972"}}
{"level":"info","ts":"2023-10-26T16:56:26.702Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38896"}}
{"level":"info","ts":"2023-10-26T16:59:09.054Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38971"}}
{"level":"info","ts":"2023-10-26T16:59:40.283Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38877"}}
{"level":"info","ts":"2023-10-26T17:04:29.440Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38782"}}
{"level":"info","ts":"2023-10-26T17:06:19.428Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"37073"}}
{"level":"info","ts":"2023-10-26T17:06:51.528Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38859"}}
{"level":"info","ts":"2023-10-26T17:09:21.780Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38974"}}
{"level":"info","ts":"2023-10-26T17:10:09.035Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38865"}}
{"level":"info","ts":"2023-10-26T17:10:39.161Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38856"}}
{"level":"info","ts":"2023-10-26T17:13:05.716Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38972"}}
{"level":"info","ts":"2023-10-26T17:13:56.948Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38975"}}
{"level":"info","ts":"2023-10-26T17:14:47.165Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38976"}}
{"level":"info","ts":"2023-10-26T17:21:00.587Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38876"}}
{"level":"info","ts":"2023-10-26T17:25:20.989Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38789"}}
{"level":"info","ts":"2023-10-26T17:32:55.331Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38841"}}
{"level":"info","ts":"2023-10-26T17:35:37.934Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38734"}}
{"level":"info","ts":"2023-10-26T17:36:13.351Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38876"}}
{"level":"info","ts":"2023-10-26T17:38:33.657Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38975"}}
{"level":"info","ts":"2023-10-26T17:39:23.620Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38804"}}
{"level":"info","ts":"2023-10-26T17:48:41.063Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38896"}}
{"level":"info","ts":"2023-10-26T17:49:13.063Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38860"}}
{"level":"info","ts":"2023-10-26T17:54:31.642Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38975"}}
{"level":"info","ts":"2023-10-26T17:58:08.096Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38877"}}
{"level":"info","ts":"2023-10-26T18:01:22.958Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38972"}}
{"level":"info","ts":"2023-10-26T18:03:00.550Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38860"}}
{"level":"info","ts":"2023-10-26T18:04:20.174Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38804"}}
{"level":"info","ts":"2023-10-26T18:05:30.875Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38966"}}
{"level":"info","ts":"2023-10-26T18:10:07.524Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38973"}}
{"level":"info","ts":"2023-10-26T18:18:20.149Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38965"}}
{"level":"info","ts":"2023-10-26T18:20:46.205Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38830"}}
{"level":"info","ts":"2023-10-26T18:21:30.371Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38977"}}
{"level":"info","ts":"2023-10-26T18:22:15.042Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38978"}}
{"level":"info","ts":"2023-10-26T18:24:09.084Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38777"}}
{"level":"info","ts":"2023-10-26T18:28:44.619Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38972"}}
{"level":"info","ts":"2023-10-26T18:31:01.891Z","caller":"events/project_command_builder.go:369","msg":"skipping repo clone since no project was modified","json":{"repo":"<redacted>","pull":"38830"}}

@Ulminator
Copy link
Author

Hi @jamengual, just bumping this thread in hopes this bug fix can get merged in!

@jamengual jamengual added the waiting-on-review Waiting for a review from a maintainer label Nov 9, 2023
@GenPage GenPage added this to the v0.27.1 milestone Dec 12, 2023
@GenPage
Copy link
Member

GenPage commented Dec 12, 2023

@Ulminator Can you resolve the file conflict and we'll get this in the next patch release. Thanks

GenPage
GenPage previously approved these changes Dec 12, 2023
@GenPage GenPage enabled auto-merge (squash) December 12, 2023 01:26
@GenPage GenPage added bug Something isn't working and removed waiting-on-review Waiting for a review from a maintainer labels Dec 12, 2023
auto-merge was automatically disabled December 18, 2023 20:11

Head branch was pushed to by a user without write access

@Ulminator Ulminator force-pushed the skip_clone_no_changes_fork_prs branch from a0ca05d to 5e40641 Compare December 18, 2023 20:11
@Ulminator
Copy link
Author

@GenPage just letting you know that I fixed the merge conflicts!

@Ulminator Ulminator requested a review from GenPage January 12, 2024 22:36
@Ulminator Ulminator force-pushed the skip_clone_no_changes_fork_prs branch from 5e40641 to aa58a11 Compare October 22, 2024 23:42
@Ulminator Ulminator requested a review from a team as a code owner October 22, 2024 23:42
@Ulminator Ulminator requested review from nitrocode and X-Guardian and removed request for a team October 22, 2024 23:42
func (c *GiteaClient) GetFileContent(logger logging.SimpleLogging, pull models.PullRequest, fileName string) (bool, []byte, error) {
logger.Debug("Getting file content for %s in Gitea pull request %d", fileName, pull.Num)

content, resp, err := c.giteaClient.GetContents(pull.BaseRepo.Owner, pull.BaseRepo.Name, pull.HeadCommit, fileName)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ulminator
Copy link
Author

Ulminator commented Oct 22, 2024

@runatlantis/maintainers I know this has been stagnant for awhile, but I'd really like to get this merged. Since I originally wrote this PR the gitea client was added so I made updates there as well. PTAL and let me know if there's anything I need to do. 🙏

@@ -347,7 +347,17 @@ func (p *DefaultProjectCommandBuilder) buildAllCommandsByCfg(ctx *command.Contex

if p.SkipCloneNoChanges && p.VCSClient.SupportsSingleFileDownload(ctx.Pull.BaseRepo) {
repoCfgFile := p.GlobalCfg.RepoConfigFile(ctx.Pull.BaseRepo.ID())
hasRepoCfg, repoCfgData, err := p.VCSClient.GetFileContent(ctx.Log, ctx.Pull, repoCfgFile)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a test for this new code?

Copy link
Author

@Ulminator Ulminator Nov 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just added a test case, regenerated the mock_client.go file with pegomock, and fixed the issue w/ the DCO status check on my first commit.

The test also made it clear I could simplify some of the logic with just always passing the HeadRepo to GetFileContent. The prior issue being the repoCfgFile never being found when attempting to get it from the HeadBranch on the BaseRepo, but that branch not existing as it is just on the HeadRepo in the case of a forked PR.

@X-Guardian X-Guardian added the needs tests Change requires tests label Nov 8, 2024
Ulminator and others added 3 commits November 8, 2024 18:49
Signed-off-by: Matt Ulmer <25484774+Ulminator@users.noreply.github.com>
Signed-off-by: Matt Ulmer <25484774+Ulminator@users.noreply.github.com>
@Ulminator Ulminator force-pushed the skip_clone_no_changes_fork_prs branch from 4f2fa3d to d209151 Compare November 9, 2024 02:51
Signed-off-by: Matt Ulmer <25484774+Ulminator@users.noreply.github.com>
@Ulminator Ulminator requested a review from X-Guardian November 9, 2024 04:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working go Pull requests that update Go code needs tests Change requires tests provider/azuredevops provider/bitbucket provider/github provider/gitlab
Projects
None yet
Development

Successfully merging this pull request may close these issues.

--skip-clone-no-changes does not work with fork PRs
4 participants