Package: gh-env-manager
GitHub Environment Manager -gh_env_managerThis tool is in early development - use with care and expect to find bugs, When you do, please raise issues to help guide development 😊GitHub Environment Manager helps you maintain GitHub ActionsSecretsandVariablesacross your repositories, andenvironmentswithin them. You provide your target state in the form of aYAMLfile - the desired Secrets and Variables that your repositories and their environments should contain - and the tool does the rest.Installationpipinstallgh-env-managerQuick start to update entities in your repositoriesgh-env-managerrequires as an input aYAMLfile that describes the target state of your GitHub repository (or repositories) and its (their) Secrets and Variables. It doesnotcreate any repositories or environments for you - so every repository, and every environment within your repositories, that you add to the configuration must exist already. The tool maintains the entities - Secrets and Variables - within.Install this tool withpip install gh-env-managerCreate a GitHub personal access token followingthis guide from GitHubCreate aYAMLfile that describes your target state, following the format below. You can also check theexample used for tests.GH_SECRET_SYNC_KEY:<your GitHub personal access token>repositories:username/repositoryname:# e.g. Antvirf/gh-environment-managersecrets:-YOUR_SECRET:"something"variables:-YOUR_VARIABLE:"something"environments:dev:# assuming 'dev' environment exists in your repositorysecrets:-YOUR_DEV_SECRET:"something"variables:-YOUR_DEV_VARIABLE:"something"# you can add as many repositories as desiredusername/repositoryname:#...secrets:...variables:...Rungh-env-manager fetch ./path_to_your_yaml_fileto get current state of your repositoriesRungh-env-manager update ./path_to_your_yaml_fileto push the contents of theYAMLfile to your repositoriesBy default, nothing is overwritten - if an entity exists already, it isNOTupdated. Use the--overwriteflag to enable that behaviour.By default, nothing is deleted - if your repository has an entity that is not in theYAMLfile, it is ignored. Use the--delete-nonexistingor--delete-nonexisting-without-promptto delete any secret or variable from your repository that was missing from your inputYAMLfile.UsagePATH_TO_FILEis always required for each command.$gh_env_manager[COMMANDS]PATH_TO_FILE[OPTIONS]# examples$gh_env_managerread.env.yaml
$gh_env_managerfetch.env.yaml
$gh_env_managerupdate.env.yaml# to overwrite existing entries$gh_env_managerupdate.env.yaml--overwrite# to delete any secret/variable missing from your YAML$gh_env_managerupdate.env.yaml--delete-nonexisting# fully sync your repository with the contents of the yaml by updating all values, and deleting any that are not present$gh_env_managerupdate.env.yaml--overwrite--delete-nonexisting-without-promptCommandsread:    Read given YAML file and output the interpreted contents.fetch:   Fetch all secrets and all variables from the specific GitHub repositories provided in your environment YAML file.update:  Update secrets and variables of the GitHub repositories using data from the provided YAML file. By default, existing secrets or variables are NOT overwritten. Trygh-env-manager update --helpto view the available options.Options forupdate-o, --overwrite: If enabled, overwrite existing secrets and values in GitHub to match the provided YAML file.  [default: False]-d, --delete-nonexisting: If enabled, delete secrets and variables that are not found in the provided YAML file.  [default: False]--delete-nonexisting-without-prompt: Applies the same commands asdelete_nonexisting, but without prompting the user for confirmation. [default: False]FAQWhy do secrets sometimes state their value asNone?GitHub Secrets API doesNOTsupport fetching thevalueof a secret, and hence they are shown asNonewhen data comingfromGitHub is output.Known missing features & potential roadmap itemsSupport for GitHub Organizations (see API ref fororg Variables,org Secrets)Potentially support for scoped secrets and variables (ability to set visibility at repo level)