Skip to content

Commit

Permalink
Address issue where no action was taken if no repos filter was specified
Browse files Browse the repository at this point in the history
  • Loading branch information
dnorth98 committed Aug 25, 2020
1 parent 0d7a195 commit a7a88b3
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## [1.2.1]

- Fix lack of processing when no --repos flag is specified

## [1.2.0]

- Support for --repos flag for selective application of secrets
Expand Down
20 changes: 19 additions & 1 deletion github-secrets-manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,25 @@ def remove_secret(repo_path, secret_name, github_handle):
for repo in repos:
repo = repo.strip()

if len(repos_filter) > 0 and repo in repos_filter:
if len(repos_filter) > 0:
if repo in repos_filter:
if remove:
if dryrun:
logging.info("DRYRUN: Removing %s from %s" % (secret_name, repo))
else:
if remove_secret(repo, secret_name, github_handle):
logging.info("Successfully removed secret %s from %s" % (secret_name, repo))
else:
logging.error("Unable to remove secret %s from %s" % (secret_name, repo))
else:
if dryrun:
logging.info("DRYRUN: Adding %s to %s" % (secret_name, repo))
else:
if upsert_secret(repo, secret_name, secret_val, github_handle):
logging.info("Successfully added/updated secret %s in repo %s" % (secret_name, repo))
else:
logging.error("Unable to add/update secret %s in repo %s" % (secret_name, repo))
else:
if remove:
if dryrun:
logging.info("DRYRUN: Removing %s from %s" % (secret_name, repo))
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def get_install_requirements(path):

setup(
name=NAME,
version="1.2.0",
version="1.2.1",
description="Manage github repo secrets using a common configuration file",
long_description=open("README.md").read(),
long_description_content_type="text/markdown",
Expand Down

0 comments on commit a7a88b3

Please sign in to comment.