andrewthetechie / gha-repo-manager

Manage your Github repo(s) settings and secrets using Github Actions and a yaml file
https://github.com/andrewthetechie/gha-repo-manager
MIT License
22 stars 6 forks source link

feat: Add ability to configure environments, collaborators, and variables #217

Closed actuarysailor closed 5 months ago

actuarysailor commented 6 months ago

Description

Updated the action to enable the configuration of:

Motivation and Context

I manage several hundred repositories at work, and we use templates to ensure that everyone has the correct CI/CD pipelines for various project types varying by platform, programming language, and teams responsible for them. While this action does not fully automate everything such that all repositories require no manual configurations, it does streamline the configuration process for new repositories, such that:

While new repositories still need their settings.yml file updated for any customizations specific to a new repository, this allows even non-admins to propose those updates via a pull request. Secret values may still need a manual configuration because it is not guaranteed that:

How Has This Been Tested?

actuarysailor commented 6 months ago

@andrewthetechie - I would really like to get this one completed. Greatly enhances the features of your action to fully manage nearly everything in a repository configuration

andrewthetechie commented 6 months ago

@actuarysailor I'll take a look this week and try to get CI passing

actuarysailor commented 6 months ago

@andrewthetechie - yes, I tried to fix as many of the CI issues as I could, the few remaining I’m not understanding what your checking for. Also seems like the issue may be in sections of code I did not update.

the action integration piece I believe may be caused by use of pull_request instead of pull_request_target because the former expects the secrets in source repo whereas latter uses destination repo when doing cross repo pull requests.

actuarysailor commented 5 months ago

@actuarysailor I think these changes are great features, and I'd be happy to merge them in. Thank you so much for taking the time to implement this. It's very cool that this action has been helpful to you. I built it to solve a problem for myself (not wanting to pay for a GitHub org for myself :P), but I'm glad it's been useful outside of that.

Before merging these changes, I left some comments on some code changes. I also ask that these features and changes be split into separate PRs instead of one large PR. Reviewing smaller PRs and reverting will be much easier if there are problems.

This should end up being 4 PRs:

  • pydantic 2.0 bump and schema changes
  • PR to implement Variables
  • PR to implement collaborators
  • PR to implement Deployment environments

Wherever possible, try to use the upstream pygithub methods for managing GitHub resources rather than re-implementing API calls. If you have to implement an API call, please document the missing feature from pygithub so that the code can be reviewed in the future to see if it can be moved to using pygithub.

Let me know if you have any questions on any of my comments! I'll check back several times during the week to answer questions or review smaller PRs as you have time to make them.

@andrewthetechie - I will add the other PRs / clean them up per your suggestions (if possible) after you merge in #225; I know some of the GitHub methods have invalid URLs, but I also see you changed version on pygithub, so maybe it is fixed in the new version.

actuarysailor commented 5 months ago

@andrewthetechie - I changed to a draft since I am making the other PRs as per your request.

andrewthetechie commented 5 months ago

Closing these per discussion with @actuarysailor in another PR.