Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sc 19672 create a tool to generate teams from GitHub part3 #3

Merged

Conversation

k-shlomi
Copy link
Contributor

@k-shlomi k-shlomi commented Aug 22, 2023

sc-19672

In this PR:

  • removed the --input flag from the cli and using unnamed arguments
  • added more tests
  • added ability to exclude wildcard topics

@shortcut-integration
Copy link

This pull request has been linked to Shortcut Story #19672: Create a tool to generate TEAMS from Github topics.

@k-shlomi k-shlomi changed the base branch from sc-19672-create-a-tool-to-generate-teams-from-github-part2 to main August 22, 2023 15:30
@codecov
Copy link

codecov bot commented Aug 23, 2023

Codecov Report

Merging #3 (920b844) into main (e2904e0) will increase coverage by 16.61%.
The diff coverage is 89.00%.

@@             Coverage Diff             @@
##             main       #3       +/-   ##
===========================================
+ Coverage   70.93%   87.54%   +16.61%     
===========================================
  Files           6        7        +1     
  Lines         258      289       +31     
===========================================
+ Hits          183      253       +70     
+ Misses         75       36       -39     
Files Changed Coverage Δ
src/scripts/create_teams.py 79.13% <81.66%> (+53.24%) ⬆️
src/shared/clients/github.py 100.00% <100.00%> (ø)
src/shared/clients/jit.py 87.62% <100.00%> (-0.73%) ⬇️
src/shared/env_tools.py 100.00% <100.00%> (ø)
src/shared/models.py 100.00% <100.00%> (ø)

add_teams_to_asset(token, asset, teams_to_update)
else:
if asset.tags and "team" in [t.name for t in asset.tags]:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if asset.tags and "team" in [t.name for t in asset.tags]:
asset_has_teams_tag = asset.tags and "team" in [t.name for t in asset.tags]
if asset_has_teams_tag:

for team in organization.teams:
team_resources = []
for resource in team.resources:
if resource.type == "github_repo" and resource.name in [asset.asset_name for asset in assets]:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move "github_repo" to Enum

Copy link
Contributor Author

@k-shlomi k-shlomi Aug 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@@ -109,7 +96,7 @@ def delete_teams(token, team_names):
break

if team_id:
url = f"{JIT_API_ENDPOINT}/teams/{team_id}"
url = f"{os.getenv('JIT_API_ENDPOINT', JIT_DEFAULT_API_ENDPOINT)}/teams/{team_id}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please move os.getenv('JIT_API_ENDPOINT', JIT_DEFAULT_API_ENDPOINT) to a small util func

@k-shlomi k-shlomi merged commit 59f407d into main Aug 23, 2023
8 of 9 checks passed
@k-shlomi k-shlomi deleted the sc-19672-create-a-tool-to-generate-teams-from-github-part3 branch August 23, 2023 14:22
Copy link

@jit-ci jit-ci bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ The following Jit checks failed to run:

  • static-code-analysis-python-semgrep

#jit_bypass_commit in this PR to bypass, Jit Admin privileges required.

More info in the Jit platform.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants