Skip to content

Commit cb48e6d

Browse files
committed
Add notification
1 parent fdc4f8d commit cb48e6d

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

hooks/post_gen_project.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,24 @@ def write_context(*, context: dict) -> None:
121121
yaml.dump(context, file)
122122

123123

124+
def notify_dockerhub_secrets() -> None:
125+
"""Notify user about required Docker Hub secrets for releases."""
126+
print("\n" + "=" * 70)
127+
print("IMPORTANT: Docker Hub Publishing Enabled")
128+
print("=" * 70)
129+
print("\nYou have enabled Docker Hub publishing for releases.")
130+
print("Please ensure the following GitHub secrets are configured:")
131+
print("\n • DOCKERHUB_USERNAME - Your Docker Hub username")
132+
print(" • DOCKERHUB_PAT - Your Docker Hub Personal Access Token")
133+
print("\nWithout these secrets, your releases will fail during the")
134+
print("Docker image publishing step.")
135+
print("\nTo add these secrets:")
136+
print("1. Go to your GitHub repository settings")
137+
print("2. Navigate to Settings → Secrets and variables → Actions")
138+
print("3. Add the required secrets")
139+
print("=" * 70 + "\n")
140+
141+
124142
def run_post_gen_hook():
125143
"""Run post generation hook"""
126144
try:
@@ -199,6 +217,10 @@ def run_post_gen_hook():
199217
# Run the initial setup step automatically so pre-commit hooks, etc. are pre-installed. However, if it fails, don't fail the overall repo generation
200218
# (i.e. check=False)
201219
subprocess.run(["task", "init"], check=False, capture_output=True)
220+
221+
# Notify about Docker Hub secrets if Docker Hub publishing is enabled
222+
if cookiecutter_context.get("dockerhub") == "yes":
223+
notify_dockerhub_secrets()
202224
except subprocess.CalledProcessError as error:
203225
stdout = error.stdout.decode("utf-8") if error.stdout else "No stdout"
204226
stderr = error.stderr.decode("utf-8") if error.stderr else "No stderr"

0 commit comments

Comments
 (0)