Yesterday I had to go through my org in github and...
# gitops
t
Yesterday I had to go through my org in github and rotate credentials. This required me to click into every repo and check the secrets individually. Does anyone know of a tool that helps with something like this? I don't care to do that again.
c
You can set secrets in one place at organization level secrets then they get re-use in all the git repos
t
100% you can, and I cleared out all kinds of repeated shit and replaced with org wide secrets, but I needed to go to every repo to check to see if anything was registered within... which is a pain.
Even something as simple as an app that generates a list of secret names and the repos they're in would have saved me a couple hours. That's probably something I can write myself.
c
I was going to say the same, next time your going to use the mouse write a script/program
c
Hey @Troy Knapp! You could try GitHubs CLI - see here: https://cli.github.com/manual/gh_secret_list
t
Yeah, that's what I'm thinking... I plugged my problem into ChatGPT and it came up with something I'll try out when I get a chance
Its using the API, but same idea
c
Using the CLI covers all the auth and fun - wrap that into a little script… and I couldn’t stop myself 😄
Copy code
gh repo list | cut -f 1 | xargs -I % gh secret list -R %
That should give you the output you desire quite quickly.
t
That's pretty slick! I'd still like to have the repos they were in printed off in the results... but that's not hard:
Copy code
gh repo list SumerSports | cut -f 1 | xargs -I % sh -c 'echo %; gh secret list -R %'
not perfect, but good enough
c
wow very cool @Clemens Jütte the gh is power tool
k
We've started to terraform our GitHub repos to avoid this kind of stuff, usually generating random secrets when possible. We have a long way to go, but the hope is to avoid this kind of stuff in the future
t
This isn't a bad idea either... I'd have to get buy in from my data scientists which seems... hard. lol
d
Another option from GitHub itself to manage repos via config file https://github.com/github/safe-settings