feat: filter repos by team ownership#242
Conversation
Signed-off-by: Zack Koppert <zkoppert@github.com>
Signed-off-by: Zack Koppert <zkoppert@github.com>
| if repositories_str and team_name: | ||
| raise ValueError( | ||
| "REPOSITORY environment variable was not set correctly. Please set it to a comma separated list of repositories in the format org/repo" | ||
| "TEAM_NAME environment variable cannot be used with ORGANIZATION or REPOSITORY" |
There was a problem hiding this comment.
I thought organization was required when using TEAM_NAME?
Also maybe add check if TEAM-NAME is used then ORGANIZATION is also set?
There was a problem hiding this comment.
Good catch! I totally got that messed up on the wording. Fixing...
I originally had in here to check if TEAM-NAME is used then ORGANIZATION is also set but the code was unreachable because we already check for ORGANIZATION or REPOSITORY, and then for TEAM_NAME and not REPOSITORY, so by deduction we've confirmed ORGANIZATION is present. By unreachable code, I mean to say I couldn't write a test that hit it because of the check for org first. If you think I should rewrite the order of the checks so its clear that case is covered, I'm happy to do that. At the time I just elected to remove unreachable code but that isn't as readable/clear.
There was a problem hiding this comment.
That's a good point re: unreachable code. I'm a fan of explicit over implicit. Not a blocker though.
Co-authored-by: Jason Meridth <jmeridth@github.com>
Signed-off-by: Zack Koppert <zkoppert@github.com>
Pull Request
fixes #74
This pull request adds a feature to support specifying a team in addition to an organization. This enables users to run the action on all the repositories owned by a team instead of having to keep that list up to date with the team ownership data already in GitHub. The most important changes include updating the
README.mdto reflect the newTEAM_NAMEparameter, modifying theenv.pyandevergreen.pyfiles to handle the new parameter, and adding tests intest_env.pyto ensure the new functionality works as expected.Proposed Changes
Documentation Updates:
README.md: AddedTEAM_NAMEparameter to describe how to configure the action for a specific team within an organization. [1] [2] [3]Code Enhancements:
env.py: Updatedget_env_varsfunction to includeteam_nameparameter and added validation to ensureTEAM_NAMEis not used withORGANIZATIONorREPOSITORY. [1] [2] [3] [4]evergreen.py: Modified the main function andget_repos_iteratorto handle repositories based on theTEAM_NAMEparameter. [1] [2] [3] [4]Testing:
test_env.py: Added new tests to verify the correct behavior whenTEAM_NAMEis set and to ensure errors are raised whenTEAM_NAMEis used withoutORGANIZATIONor withREPOSITORY. [1] [2] [3] [4] [5] [6]Readiness Checklist
Author/Contributor
make lintand fix any issues that you have introducedmake testand ensure you have test coverage for the lines you are introducing@jeffrey-luszczReviewer
fix,documentation,enhancement,infrastructure,maintenanceorbreaking