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

Feature request: scan the repo only if there has been a commit to it after a given date #44

Closed
KarahanGuner opened this issue Jan 10, 2023 · 3 comments · Fixed by #47
Closed
Assignees
Labels
enhancement New feature or request

Comments

@KarahanGuner
Copy link

KarahanGuner commented Jan 10, 2023

If an organization has hundreds of different repositories it takes a while to scan them all. It would be great if we could pass a date parameter that would make it so that a repo gets scanned only if there has been a commit to it after that date. With this, you could pass the date of the last scan, and you wouldnt need to scan repositories that havent been changed.

@SimonGurney
Copy link
Contributor

Thanks for the suggestion. I agree, this would be awesome.

The APIs for github/gitlab/bitbucket dont provide a reliable way to do this, but we can use the commit date of the repo. This isn't entirely accurate either, as you can push up last weeks commits (which are new to the server, but a week old already!).

We had some discussions and figured the best way to implement this was to clone the repo down and then assess each branch. This way:

  • If a repo is stale, we wont scan any branches
  • If a repo is active, we will only scan active branches

It does mean that you would have the issue where you could end up not scanning commits, even though they were only pushed up to the server recently.

I would recommend using this feature to scan branches that have had a commit in the last 3 months etc.

I do not recommend using it to filter out branches that have not had a commit in the last week etc.

@SimonGurney SimonGurney added the enhancement New feature or request label Jan 10, 2023
@SimonGurney SimonGurney linked a pull request Jan 10, 2023 that will close this issue
@KarahanGuner
Copy link
Author

This is an interesting problem. One idea could be to substract couple of months from the users input. This way, commits made before the date of the last scan but pushed after it could be accounted for. This may result in some unnecessary scans but it could be worth it for the sake of not missing anything.

@SimonGurney
Copy link
Contributor

We have we have a good way to implement, you can see it in the pull request. We just need to make a quick tweak and then we'll merge and let you know :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants