Skip to content

Commit

Permalink
Merge pull request #1812 from isuruf/cirun-all
Browse files Browse the repository at this point in the history
Send all resources at once to cirun
  • Loading branch information
isuruf authored Jan 8, 2024
2 parents 870b939 + 1c6b910 commit 1d54376
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 13 deletions.
6 changes: 3 additions & 3 deletions conda_smithy/cirun_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def enable_cirun_for_project(owner: str, repo: str) -> Dict[str, Any]:
def add_repo_to_cirun_resource(
owner: str,
repo: str,
resource: str,
resources: List[str],
teams: List,
roles: List,
users_from_json: Optional[str] = None,
Expand All @@ -52,7 +52,7 @@ def add_repo_to_cirun_resource(
if cirun_policy_args and "pull_request" in cirun_policy_args:
policy_args = {"pull_request": True}
print(
f"Adding repo {owner}/{repo} to resource {resource} with policy_args: {policy_args}"
f"Adding repo {owner}/{repo} to resources {resources} with policy_args: {policy_args}"
)
gh = Github(gh_token())
gh_owner = gh.get_user(owner)
Expand All @@ -67,7 +67,7 @@ def add_repo_to_cirun_resource(
response = cirun.add_repo_to_resources(
owner,
repo,
resources=[resource],
resources=resources,
policy_args=policy_args,
teams=teams,
roles=roles,
Expand Down
19 changes: 9 additions & 10 deletions conda_smithy/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,16 +432,15 @@ def __call__(self, args):
f"Cirun Registration: resources to add to: {owner}/{repo}"
)
conda_smithy.cirun_utils.enable_cirun_for_project(owner, repo)
for resource in args.cirun_resources:
conda_smithy.cirun_utils.add_repo_to_cirun_resource(
owner,
repo,
resource,
cirun_policy_args=args.cirun_policy_args,
teams=args.cirun_teams,
roles=args.cirun_roles,
users_from_json=args.cirun_users_from_json,
)
conda_smithy.cirun_utils.add_repo_to_cirun_resource(
owner,
repo,
args.cirun_resources,
cirun_policy_args=args.cirun_policy_args,
teams=args.cirun_teams,
roles=args.cirun_roles,
users_from_json=args.cirun_users_from_json,
)
else:
print("Cirun registration disabled.")

Expand Down
23 changes: 23 additions & 0 deletions news/cirun-resources.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
**Added:**

* <news item>

**Changed:**

* <news item>

**Deprecated:**

* <news item>

**Removed:**

* <news item>

**Fixed:**

* Code refactoring for cirun. (#1812)

**Security:**

* <news item>

0 comments on commit 1d54376

Please sign in to comment.