Github enterprise can generate a CSV report about dormant / inactive users, but you have then to manually remove these users and when you have many, it takes a lot of time.
Is there any API or script allowing to remove all these users from the enterprise, and all organizations it contains?
I had no luck to find such API, script, or command in Github CLI, so i asked Github support, and they shared this GraphQL API, which is quite a recent addition: https://docs.github.com/en/enterprise-cloud@latest/graphql/reference/mutations#removeenterprisemember
My AI friend and I developed this Python script, that hopefully will be useful to you too. The little trick to know about GraphQL is that ids, for users, enterprise, etc are specific, you cannot use the same ids/slugs than the ones you would use with the REST API. The first step is to get the id of your Github enterprise, and then the id of the users you want to remove.