NickLiffen / ghas-enablement

A tool that aims to bulk automates the enablement of GitHub Code Scanning, Secret Scanning and Dependabot across multiple repositories.
152 stars 52 forks source link

How do I call `getRepos` and query for just repositories with a prefix #97

Closed benhorgen closed 1 year ago

benhorgen commented 1 year ago

I'd like to query a subset of the repos in our GH Enterprise set of repositories by using a prefix, for example bh-repos-...

@NickLiffen, can you remind me where in my .env file I paste that prefix to limit my GH repo query?

NickLiffen commented 1 year ago

Hey @benhorgen 👋

The way to do this today is by pulling all the repos possible, and filtering out after the npm run getRepos command has been run 👍

It would be nice to get something added where it only returns based on a prefix. But in theory, you could do this today bu just collecting all repos possible, and then before you run npm run start, you can go to the repos.json file and just do a command find based on your prefix of choice, and remove anything that doesn't match that prefix 👍

I hope this makes sense>

benhorgen commented 1 year ago

That makes sense. But with a large repo set that can be a a lot of cleanup of the repos.json file. If you have thousand or more repos it would be very nice filter by prefix/suffix/etc. I'll consider modifying the script and making a PR. :)