Skip to content

Commit 1102f16

Browse files
committed
updating discription of issues
1 parent 6dac535 commit 1102f16

2 files changed

Lines changed: 26 additions & 5 deletions

File tree

devolv/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
__version__ = "0.2.14"
1+
__version__ = "0.2.15"
22

devolv/drift/issues.py

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
11
from github import Github
22
import time
33

4-
def create_approval_issue(repo_full_name, token, policy_name,assignees=None):
4+
def create_approval_issue(repo_full_name, token, policy_name, assignees=None):
55
gh = Github(token)
66
repo = gh.get_repo(repo_full_name)
77

8+
approver_list = ", ".join([f"@{a}" for a in assignees]) if assignees else "anyone"
9+
810
title = f"Approval needed for IAM policy: {policy_name}"
9-
body = f"Please review and approve the sync for `{policy_name}`."
11+
body = (
12+
f"Please review and approve the sync for `{policy_name}`.\n\n"
13+
f"✅ **Allowed approvers:** {approver_list}\n\n"
14+
"**Reply with one of the following commands to proceed:**\n"
15+
"- `local->aws` → Apply local policy changes to AWS\n"
16+
"- `aws->local` → Update local policy file from AWS\n"
17+
"- `aws<->local` → Sync both ways (superset, update AWS + local)\n"
18+
"- `skip` → Skip this sync"
19+
)
1020

1121
issue = repo.create_issue(
1222
title=title,
@@ -17,16 +27,27 @@ def create_approval_issue(repo_full_name, token, policy_name,assignees=None):
1727
print(f"✅ Created issue #{issue.number} in {repo_full_name}: {issue.html_url}")
1828
return issue.number, issue.html_url
1929

20-
def wait_for_sync_choice(repo_full_name, issue_number, token):
30+
31+
def wait_for_sync_choice(repo_full_name, issue_number, token, allowed_approvers=None):
2132
g = Github(token)
2233
repo = g.get_repo(repo_full_name)
2334
issue = repo.get_issue(number=issue_number)
2435

36+
allowed_approvers = [a.lower() for a in (allowed_approvers or [])]
37+
2538
while True:
2639
comments = issue.get_comments()
2740
for comment in comments:
41+
commenter = comment.user.login.lower()
2842
content = comment.body.strip().lower()
43+
44+
if allowed_approvers and commenter not in allowed_approvers:
45+
print(f"Ignoring comment from unauthorized user: {commenter}")
46+
continue
47+
2948
if content in ["local->aws", "aws->local", "aws<->local", "skip"]:
3049
return content
50+
3151
print("Waiting for approval comment...")
32-
time.sleep(30) # Poll every 30 seconds
52+
time.sleep(30)
53+

0 commit comments

Comments
 (0)