RepoAuditor 0.2.20__tar.gz → 0.2.22__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {repoauditor-0.2.20 → repoauditor-0.2.22}/PKG-INFO +1 -1
- {repoauditor-0.2.20 → repoauditor-0.2.22}/pyproject.toml +1 -1
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Plugins/GitHub/ClassicBranchProtectionQuery.py +54 -51
- repoauditor-0.2.22/src/RepoAuditor/Plugins/GitHub/Module.py +33 -0
- repoauditor-0.2.22/src/RepoAuditor/Plugins/GitHub/StandardQuery.py +248 -0
- {repoauditor-0.2.20/src/RepoAuditor/Plugins/GitHub → repoauditor-0.2.22/src/RepoAuditor/Plugins/GitHubBase}/Module.py +144 -158
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Plugins/GitHubCustomization/Module.py +5 -16
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/__init__.py +1 -1
- repoauditor-0.2.22/src/RepoAuditor/py.typed +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/tests/Plugins/GitHubModule_UnitTest.py +2 -1
- {repoauditor-0.2.20 → repoauditor-0.2.22}/tests/Plugins/GitHub_EndToEndTest.py +2 -31
- {repoauditor-0.2.20 → repoauditor-0.2.22}/tests/Plugins/utilities.py +36 -2
- repoauditor-0.2.20/src/RepoAuditor/Plugins/GitHub/StandardQuery.py +0 -245
- {repoauditor-0.2.20 → repoauditor-0.2.22}/.copier-answers.yml +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/.github/CODEOWNERS +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/.github/ISSUE_TEMPLATE/config.yml +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/.github/ISSUE_TEMPLATE/custom.md +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/.github/actions/release_impl/action.yml +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/.github/pull_request_template.md +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/.github/release_sources.yaml +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/.github/workflows/CICD.yml +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/.github/workflows/CICD_impl.yml +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/.github/workflows/codeql.yml +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/.gitignore +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/.pre-commit-config.yaml +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/.python-version +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/CODE_OF_CONDUCT.md +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/CONTRIBUTING.md +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/DEVELOPMENT.md +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/GOVERNANCE.md +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/LICENSE +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/MAINTAINERS.md +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/README.md +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/SECURITY.md +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/minisign_key.pub +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/AutoGitSemVer.yaml +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/CommandLineProcessor.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/EntryPoint.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/ExecuteModules.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Impl/ParallelSequentialProcessor.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Impl/__init__.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Module.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Plugin.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Plugins/GitHub/ClassicBranchProtectionRequirements/AllowDeletions.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Plugins/GitHub/ClassicBranchProtectionRequirements/AllowForcePushes.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Plugins/GitHub/ClassicBranchProtectionRequirements/DismissStalePullRequestApprovals.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Plugins/GitHub/ClassicBranchProtectionRequirements/DoNotAllowBypassSettings.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Plugins/GitHub/ClassicBranchProtectionRequirements/EnsureStatusChecks.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Plugins/GitHub/ClassicBranchProtectionRequirements/Impl/ClassicEnableRequirementImpl.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Plugins/GitHub/ClassicBranchProtectionRequirements/Impl/ClassicValueRequirementImpl.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Plugins/GitHub/ClassicBranchProtectionRequirements/Impl/__init__.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Plugins/GitHub/ClassicBranchProtectionRequirements/RequireApprovalMostRecentPush.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Plugins/GitHub/ClassicBranchProtectionRequirements/RequireApprovals.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Plugins/GitHub/ClassicBranchProtectionRequirements/RequireCodeOwnerReview.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Plugins/GitHub/ClassicBranchProtectionRequirements/RequireConversationResolution.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Plugins/GitHub/ClassicBranchProtectionRequirements/RequireLinearHistory.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Plugins/GitHub/ClassicBranchProtectionRequirements/RequirePullRequests.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Plugins/GitHub/ClassicBranchProtectionRequirements/RequireSignedCommits.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Plugins/GitHub/ClassicBranchProtectionRequirements/RequireStatusChecksToPass.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Plugins/GitHub/ClassicBranchProtectionRequirements/RequireUpToDateBranches.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Plugins/GitHub/ClassicBranchProtectionRequirements/__init__.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Plugins/GitHub/DefaultBranchQuery.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Plugins/GitHub/DefaultBranchQueryRequirements/Protected.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Plugins/GitHub/DefaultBranchQueryRequirements/__init__.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Plugins/GitHub/Impl/Common.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Plugins/GitHub/Impl/EnableRequirementImpl.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Plugins/GitHub/Impl/ValueRequirementImpl.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Plugins/GitHub/Impl/__init__.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/AutoMerge.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/DefaultBranch.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/DeleteHeadBranches.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/DependabotSecurityUpdates.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/Description.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/Impl/StandardEnableRequirementImpl.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/Impl/StandardValueRequirementImpl.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/Impl/__init__.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/License.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/MergeCommit.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/MergeCommitMessage.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/Private.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/RebaseMergeCommit.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/SecretScanning.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/SecretScanningPushProtection.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/SquashCommitMerge.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/SquashMergeCommitMessage.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/SuggestUpdatingPullRequestBranches.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/SupportDiscussions.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/SupportIssues.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/SupportProjects.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/SupportWikis.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/TemplateRepository.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/WebCommitSignoff.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/__init__.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Plugins/GitHub/__init__.py +0 -0
- {repoauditor-0.2.20/src/RepoAuditor/Plugins/GitHubCustomization → repoauditor-0.2.22/src/RepoAuditor/Plugins/GitHubBase}/__init__.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Plugins/GitHubCustomization/CustomizationQuery.py +0 -0
- {repoauditor-0.2.20/src/RepoAuditor/Plugins → repoauditor-0.2.22/src/RepoAuditor/Plugins/GitHubCustomization}/__init__.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Plugins/GitHubCustomizationPlugin.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Plugins/GitHubPlugin.py +0 -0
- /repoauditor-0.2.20/src/RepoAuditor/py.typed → /repoauditor-0.2.22/src/RepoAuditor/Plugins/__init__.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Query.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/src/RepoAuditor/Requirement.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/tests/CommandLineProcessor_UnitTest.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/tests/EntryPoint_UnitTest.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/tests/ExecuteModules_UnitTest.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/tests/Module_UnitTest.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/tests/Plugin_UnitTest.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/tests/Plugins/GitHubCustomization_UnitTest.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/tests/Plugins/__snapshots__/GitHub_EndToEndTest.ambr +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/tests/Query_UnitTest.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/tests/Requirement_UnitTest.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/tests/__snapshots__/ExecuteModules_UnitTest.ambr +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.22}/uv.lock +0 -0
|
@@ -4,7 +4,60 @@
|
|
|
4
4
|
# | Distributed under the MIT License.
|
|
5
5
|
# |
|
|
6
6
|
# -------------------------------------------------------------------------------
|
|
7
|
-
"""Contains the ClassicBranchProtection object.
|
|
7
|
+
"""Contains the ClassicBranchProtection object.
|
|
8
|
+
|
|
9
|
+
The API request/response has the following schema:
|
|
10
|
+
|
|
11
|
+
REQUEST : https://api.github.com/repos/<username>/<repo>/branches/<branch>/protection
|
|
12
|
+
RESPONSE:
|
|
13
|
+
{
|
|
14
|
+
"url": <not used>,
|
|
15
|
+
"required_status_checks": { /* RequireStatusChecksToPass */
|
|
16
|
+
"url": <not used>,
|
|
17
|
+
"strict": RequireUpToDateBranches,
|
|
18
|
+
"contexts": <not used>,
|
|
19
|
+
"contexts_url": <not used>,
|
|
20
|
+
"checks": EnsureStatusChecks
|
|
21
|
+
},
|
|
22
|
+
"required_pull_request_reviews": { /* RequirePullRequests */
|
|
23
|
+
"url": <not used>,
|
|
24
|
+
"dismiss_stale_reviews": DismissStalePullRequestApprovals,
|
|
25
|
+
"require_code_owner_reviews": RequireCodeOwnerReview,
|
|
26
|
+
"require_last_push_approval": RequireApprovalMostRecentPush,
|
|
27
|
+
"required_approving_review_count": RequireApprovals,
|
|
28
|
+
"bypass_pull_request_allowances": <not used>,
|
|
29
|
+
},
|
|
30
|
+
"required_signatures": {
|
|
31
|
+
"url": <not used>,
|
|
32
|
+
"enabled": RequireSignedCommits
|
|
33
|
+
},
|
|
34
|
+
"enforce_admins": {
|
|
35
|
+
"url": <not used>,
|
|
36
|
+
"enabled": DoNotAllowBypassSettings
|
|
37
|
+
},
|
|
38
|
+
"required_linear_history": {
|
|
39
|
+
"enabled": RequireLinearHistory
|
|
40
|
+
},
|
|
41
|
+
"allow_force_pushes": {
|
|
42
|
+
"enabled": AllowForcePushes
|
|
43
|
+
},
|
|
44
|
+
"allow_deletions": {
|
|
45
|
+
"enabled": AllowDeletions
|
|
46
|
+
},
|
|
47
|
+
"block_creations": {
|
|
48
|
+
"enabled": <not used>
|
|
49
|
+
},
|
|
50
|
+
"required_conversation_resolution": {
|
|
51
|
+
"enabled": RequireConversationResolution
|
|
52
|
+
},
|
|
53
|
+
"lock_branch": {
|
|
54
|
+
"enabled": <not used>
|
|
55
|
+
},
|
|
56
|
+
"allow_fork_syncing": {
|
|
57
|
+
"enabled": <not used>
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
"""
|
|
8
61
|
|
|
9
62
|
from typing import Any, Optional
|
|
10
63
|
|
|
@@ -33,56 +86,6 @@ from .ClassicBranchProtectionRequirements.RequireSignedCommits import RequireSig
|
|
|
33
86
|
from .ClassicBranchProtectionRequirements.RequireStatusChecksToPass import RequireStatusChecksToPass
|
|
34
87
|
from .ClassicBranchProtectionRequirements.RequireUpToDateBranches import RequireUpToDateBranches
|
|
35
88
|
|
|
36
|
-
# REQUEST : https://api.github.com/repos/<username>/<repo>/branches/<branch>/protection
|
|
37
|
-
# RESPONSE:
|
|
38
|
-
# {
|
|
39
|
-
# "url": <not used>,
|
|
40
|
-
# "required_status_checks": { /* RequireStatusChecksToPass */
|
|
41
|
-
# "url": <not used>,
|
|
42
|
-
# "strict": RequireUpToDateBranches,
|
|
43
|
-
# "contexts": <not used>,
|
|
44
|
-
# "contexts_url": <not used>,
|
|
45
|
-
# "checks": EnsureStatusChecks
|
|
46
|
-
# },
|
|
47
|
-
# "required_pull_request_reviews": { /* RequirePullRequests */
|
|
48
|
-
# "url": <not used>,
|
|
49
|
-
# "dismiss_stale_reviews": DismissStalePullRequestApprovals,
|
|
50
|
-
# "require_code_owner_reviews": RequireCodeOwnerReview,
|
|
51
|
-
# "require_last_push_approval": RequireApprovalMostRecentPush,
|
|
52
|
-
# "required_approving_review_count": RequireApprovals,
|
|
53
|
-
# "bypass_pull_request_allowances": <not used>,
|
|
54
|
-
# },
|
|
55
|
-
# "required_signatures": {
|
|
56
|
-
# "url": <not used>,
|
|
57
|
-
# "enabled": RequireSignedCommits
|
|
58
|
-
# },
|
|
59
|
-
# "enforce_admins": {
|
|
60
|
-
# "url": <not used>,
|
|
61
|
-
# "enabled": DoNotAllowBypassSettings
|
|
62
|
-
# },
|
|
63
|
-
# "required_linear_history": {
|
|
64
|
-
# "enabled": RequireLinearHistory
|
|
65
|
-
# },
|
|
66
|
-
# "allow_force_pushes": {
|
|
67
|
-
# "enabled": AllowForcePushes
|
|
68
|
-
# },
|
|
69
|
-
# "allow_deletions": {
|
|
70
|
-
# "enabled": AllowDeletions
|
|
71
|
-
# },
|
|
72
|
-
# "block_creations": {
|
|
73
|
-
# "enabled": <not used>
|
|
74
|
-
# },
|
|
75
|
-
# "required_conversation_resolution": {
|
|
76
|
-
# "enabled": RequireConversationResolution
|
|
77
|
-
# },
|
|
78
|
-
# "lock_branch": {
|
|
79
|
-
# "enabled": <not used>
|
|
80
|
-
# },
|
|
81
|
-
# "allow_fork_syncing": {
|
|
82
|
-
# "enabled": <not used>
|
|
83
|
-
# }
|
|
84
|
-
# }
|
|
85
|
-
|
|
86
89
|
|
|
87
90
|
# ----------------------------------------------------------------------
|
|
88
91
|
class ClassicBranchProtectionQuery(Query):
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# -------------------------------------------------------------------------------
|
|
2
|
+
# |
|
|
3
|
+
# | Copyright (c) 2024 Scientific Software Engineering Center at Georgia Tech
|
|
4
|
+
# | Distributed under the MIT License.
|
|
5
|
+
# |
|
|
6
|
+
# -------------------------------------------------------------------------------
|
|
7
|
+
"""Contains the GitHubModule object."""
|
|
8
|
+
|
|
9
|
+
from RepoAuditor.Module import ExecutionStyle
|
|
10
|
+
from RepoAuditor.Plugins.GitHubBase.Module import GitHubBaseModule
|
|
11
|
+
|
|
12
|
+
from .ClassicBranchProtectionQuery import ClassicBranchProtectionQuery
|
|
13
|
+
from .DefaultBranchQuery import DefaultBranchQuery
|
|
14
|
+
from .StandardQuery import StandardQuery
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# ----------------------------------------------------------------------
|
|
18
|
+
class GitHubModule(GitHubBaseModule):
|
|
19
|
+
"""Module for validating GitHub repository configuration settings."""
|
|
20
|
+
|
|
21
|
+
# ----------------------------------------------------------------------
|
|
22
|
+
def __init__(self) -> None:
|
|
23
|
+
super().__init__(
|
|
24
|
+
"GitHub",
|
|
25
|
+
"Validates GitHub configuration settings.",
|
|
26
|
+
ExecutionStyle.Parallel,
|
|
27
|
+
[
|
|
28
|
+
StandardQuery(),
|
|
29
|
+
DefaultBranchQuery(),
|
|
30
|
+
ClassicBranchProtectionQuery(),
|
|
31
|
+
],
|
|
32
|
+
requires_explicit_include=True,
|
|
33
|
+
)
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
# -------------------------------------------------------------------------------
|
|
2
|
+
# |
|
|
3
|
+
# | Copyright (c) 2024 Scientific Software Engineering Center at Georgia Tech
|
|
4
|
+
# | Distributed under the MIT License.
|
|
5
|
+
# |
|
|
6
|
+
# -------------------------------------------------------------------------------
|
|
7
|
+
"""Contains the StandardQuery object.
|
|
8
|
+
|
|
9
|
+
The API request/response has the following schema:
|
|
10
|
+
|
|
11
|
+
REQUEST: https://api.github.com/repos/<username>/<repo>
|
|
12
|
+
RESPONSE:
|
|
13
|
+
{
|
|
14
|
+
"id": <not used>,
|
|
15
|
+
"node_id": <not used>,
|
|
16
|
+
"name": <not used>",
|
|
17
|
+
"full_name": <not used>,
|
|
18
|
+
"private": Private,
|
|
19
|
+
"owner": {
|
|
20
|
+
"login": <not used>,
|
|
21
|
+
"id": <not used>,
|
|
22
|
+
"node_id": <not used>,
|
|
23
|
+
"avatar_url": <not used>,
|
|
24
|
+
"gravatar_id": <not used>,
|
|
25
|
+
"url": <not used>,
|
|
26
|
+
"html_url": <not used>,
|
|
27
|
+
"followers_url": <not used>,
|
|
28
|
+
"following_url": <not used>,
|
|
29
|
+
"gists_url": <not used>,
|
|
30
|
+
"starred_url": <not used>,
|
|
31
|
+
"subscriptions_url": <not used>,
|
|
32
|
+
"organizations_url": <not used>,
|
|
33
|
+
"repos_url": <not used>,
|
|
34
|
+
"events_url": <not used>,
|
|
35
|
+
"received_events_url": <not used>,
|
|
36
|
+
"type": <not used>,
|
|
37
|
+
"site_admin": <not used>
|
|
38
|
+
},
|
|
39
|
+
"html_url": <not used>,
|
|
40
|
+
"description": Description,
|
|
41
|
+
"fork": <not used>,
|
|
42
|
+
"url": <not used>,
|
|
43
|
+
"forks_url": <not used>,
|
|
44
|
+
"keys_url": <not used>,
|
|
45
|
+
"collaborators_url": <not used>,
|
|
46
|
+
"teams_url": <not used>,
|
|
47
|
+
"hooks_url": <not used>,
|
|
48
|
+
"issue_events_url": <not used>,
|
|
49
|
+
"events_url": <not used>,
|
|
50
|
+
"assignees_url": <not used>,
|
|
51
|
+
"branches_url": <not used>,
|
|
52
|
+
"tags_url": <not used>,
|
|
53
|
+
"blobs_url": <not used>,
|
|
54
|
+
"git_tags_url": <not used>,
|
|
55
|
+
"git_refs_url": <not used>,
|
|
56
|
+
"trees_url": <not used>,
|
|
57
|
+
"statuses_url": <not used>,
|
|
58
|
+
"languages_url": <not used>,
|
|
59
|
+
"stargazers_url": <not used>,
|
|
60
|
+
"contributors_url": <not used>,
|
|
61
|
+
"subscribers_url": <not used>,
|
|
62
|
+
"subscription_url": <not used>,
|
|
63
|
+
"commits_url": <not used>,
|
|
64
|
+
"git_commits_url": <not used>,
|
|
65
|
+
"comments_url": <not used>,
|
|
66
|
+
"issue_comment_url": <not used>,
|
|
67
|
+
"contents_url": <not used>,
|
|
68
|
+
"compare_url": <not used>,
|
|
69
|
+
"merges_url": <not used>,
|
|
70
|
+
"archive_url": <not used>,
|
|
71
|
+
"downloads_url": <not used>,
|
|
72
|
+
"issues_url": <not used>,
|
|
73
|
+
"pulls_url": <not used>,
|
|
74
|
+
"milestones_url": <not used>,
|
|
75
|
+
"notifications_url": <not used>,
|
|
76
|
+
"labels_url": <not used>,
|
|
77
|
+
"releases_url": <not used>,
|
|
78
|
+
"deployments_url": <not used>,
|
|
79
|
+
"created_at": <not used>,
|
|
80
|
+
"updated_at": <not used>,
|
|
81
|
+
"pushed_at": <not used>,
|
|
82
|
+
"git_url": <not used>,
|
|
83
|
+
"ssh_url": <not used>,
|
|
84
|
+
"clone_url": <not used>,
|
|
85
|
+
"svn_url": <not used>,
|
|
86
|
+
"homepage": <not used>,
|
|
87
|
+
"size": <not used>,
|
|
88
|
+
"stargazers_count": <not used>,
|
|
89
|
+
"watchers_count": <not used>,
|
|
90
|
+
"language": <not used>,
|
|
91
|
+
"has_issues": SupportIssues,
|
|
92
|
+
"has_projects": SupportProjects,
|
|
93
|
+
"has_downloads": <not used> (No way to set value in GitHub settings),
|
|
94
|
+
"has_wiki": SupportWikis,
|
|
95
|
+
"has_pages": <not used>,
|
|
96
|
+
"has_discussions": SupportDiscussions,
|
|
97
|
+
"forks_count": <not used>,
|
|
98
|
+
"mirror_url": <not used>,
|
|
99
|
+
"archived": <not used>,
|
|
100
|
+
"disabled": <not used>,
|
|
101
|
+
"open_issues_count": <not used>,
|
|
102
|
+
"license": {
|
|
103
|
+
"key": <not used>,
|
|
104
|
+
"name": License,
|
|
105
|
+
"spdx_id": <not used>,
|
|
106
|
+
"url": <not used>,
|
|
107
|
+
"node_id": <not used>
|
|
108
|
+
},
|
|
109
|
+
"allow_forking": <not used> (No way to set value in GitHub settings),
|
|
110
|
+
"is_template": <not used>,
|
|
111
|
+
"web_commit_signoff_required": WebCommitSignoff,
|
|
112
|
+
"topics": <not used>,
|
|
113
|
+
"visibility": Private,
|
|
114
|
+
"forks": <not used>,
|
|
115
|
+
"open_issues": <not used>,
|
|
116
|
+
"watchers": <not used>,
|
|
117
|
+
"default_branch": DefaultBranch,
|
|
118
|
+
"permissions": {
|
|
119
|
+
"admin": <not used>,
|
|
120
|
+
"maintain": <not used>,
|
|
121
|
+
"push": <not used>,
|
|
122
|
+
"triage": <not used>,
|
|
123
|
+
"pull": <not used>
|
|
124
|
+
},
|
|
125
|
+
"temp_clone_token": <not used>,
|
|
126
|
+
"allow_squash_merge": SquashMergeCommit,
|
|
127
|
+
"allow_merge_commit": MergeCommit,
|
|
128
|
+
"allow_rebase_merge": RebaseMergeCommit,
|
|
129
|
+
"allow_auto_merge": AutoMerge,
|
|
130
|
+
"delete_branch_on_merge": DeleteHeadBranches,
|
|
131
|
+
"allow_update_branch": SuggestUpdatingPullRequestBranches,
|
|
132
|
+
"use_squash_pr_title_as_default": <not used> (No way to set value in GitHub settings),
|
|
133
|
+
"squash_merge_commit_message": SquashMergeCommitMessage,
|
|
134
|
+
"squash_merge_commit_title": <not used> (No way to set value in GitHub settings),
|
|
135
|
+
"merge_commit_message": MergeCommitMessage,
|
|
136
|
+
"merge_commit_title": <not used> (No way to set value in GitHub settings),
|
|
137
|
+
"custom_properties": <not used>,
|
|
138
|
+
"organization": {
|
|
139
|
+
"login": <not used>,
|
|
140
|
+
"id": <not used>,
|
|
141
|
+
"node_id": <not used>,
|
|
142
|
+
"avatar_url": <not used>,
|
|
143
|
+
"gravatar_id": <not used>,
|
|
144
|
+
"url": <not used>,
|
|
145
|
+
"html_url": <not used>,
|
|
146
|
+
"followers_url": <not used>,
|
|
147
|
+
"following_url": <not used>,
|
|
148
|
+
"gists_url": <not used>,
|
|
149
|
+
"starred_url": <not used>,
|
|
150
|
+
"subscriptions_url": <not used>,
|
|
151
|
+
"organizations_url": <not used>,
|
|
152
|
+
"repos_url": <not used>,
|
|
153
|
+
"events_url": <not used>,
|
|
154
|
+
"received_events_url": <not used>,
|
|
155
|
+
"type": <not used>,
|
|
156
|
+
"site_admin": <not used>
|
|
157
|
+
},
|
|
158
|
+
"security_and_analysis": {
|
|
159
|
+
"secret_scanning": SecretScanning,
|
|
160
|
+
"secret_scanning_push_protection": SecretScanningPushProtection,
|
|
161
|
+
"dependabot_security_updates": DependabotSecurityUpdates,
|
|
162
|
+
"secret_scanning_validity_checks": <not used> (The functionality doesn't seem to be available in the UX yet (https://github.blog/2023-10-04-introducing-secret-scanning-validity-checks-for-major-cloud-services/))
|
|
163
|
+
},
|
|
164
|
+
"network_count": <not used>,
|
|
165
|
+
"subscribers_count": <not used>
|
|
166
|
+
}
|
|
167
|
+
"""
|
|
168
|
+
|
|
169
|
+
from typing import Any, Optional
|
|
170
|
+
|
|
171
|
+
from dbrownell_Common.Types import override # type: ignore[import-untyped]
|
|
172
|
+
|
|
173
|
+
from RepoAuditor.Query import ExecutionStyle, Query
|
|
174
|
+
|
|
175
|
+
from .StandardQueryRequirements.AutoMerge import AutoMerge
|
|
176
|
+
from .StandardQueryRequirements.DefaultBranch import DefaultBranch
|
|
177
|
+
from .StandardQueryRequirements.DeleteHeadBranches import DeleteHeadBranches
|
|
178
|
+
from .StandardQueryRequirements.Description import Description
|
|
179
|
+
from .StandardQueryRequirements.DependabotSecurityUpdates import DependabotSecurityUpdates
|
|
180
|
+
from .StandardQueryRequirements.License import License
|
|
181
|
+
from .StandardQueryRequirements.MergeCommit import MergeCommit
|
|
182
|
+
from .StandardQueryRequirements.MergeCommitMessage import MergeCommitMessage
|
|
183
|
+
from .StandardQueryRequirements.Private import Private
|
|
184
|
+
from .StandardQueryRequirements.RebaseMergeCommit import RebaseMergeCommit
|
|
185
|
+
from .StandardQueryRequirements.SecretScanning import SecretScanning
|
|
186
|
+
from .StandardQueryRequirements.SecretScanningPushProtection import SecretScanningPushProtection
|
|
187
|
+
from .StandardQueryRequirements.SquashCommitMerge import SquashCommitMerge
|
|
188
|
+
from .StandardQueryRequirements.SquashMergeCommitMessage import SquashMergeCommitMessage
|
|
189
|
+
from .StandardQueryRequirements.SuggestUpdatingPullRequestBranches import (
|
|
190
|
+
SuggestUpdatingPullRequestBranches,
|
|
191
|
+
)
|
|
192
|
+
from .StandardQueryRequirements.SupportDiscussions import SupportDiscussions
|
|
193
|
+
from .StandardQueryRequirements.SupportIssues import SupportIssues
|
|
194
|
+
from .StandardQueryRequirements.SupportProjects import SupportProjects
|
|
195
|
+
from .StandardQueryRequirements.SupportWikis import SupportWikis
|
|
196
|
+
from .StandardQueryRequirements.TemplateRepository import TemplateRepository
|
|
197
|
+
from .StandardQueryRequirements.WebCommitSignoff import WebCommitSignoff
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
# ----------------------------------------------------------------------
|
|
201
|
+
class StandardQuery(Query):
|
|
202
|
+
"""Query with requirements that operate on basic GitHub repository data."""
|
|
203
|
+
|
|
204
|
+
# ----------------------------------------------------------------------
|
|
205
|
+
def __init__(self) -> None:
|
|
206
|
+
super().__init__(
|
|
207
|
+
"StandardQuery",
|
|
208
|
+
ExecutionStyle.Parallel,
|
|
209
|
+
[
|
|
210
|
+
AutoMerge(),
|
|
211
|
+
DefaultBranch(),
|
|
212
|
+
DeleteHeadBranches(),
|
|
213
|
+
Description(),
|
|
214
|
+
DependabotSecurityUpdates(),
|
|
215
|
+
License(),
|
|
216
|
+
MergeCommit(),
|
|
217
|
+
MergeCommitMessage(),
|
|
218
|
+
Private(),
|
|
219
|
+
RebaseMergeCommit(),
|
|
220
|
+
SecretScanning(),
|
|
221
|
+
SecretScanningPushProtection(),
|
|
222
|
+
SquashCommitMerge(),
|
|
223
|
+
SquashMergeCommitMessage(),
|
|
224
|
+
SuggestUpdatingPullRequestBranches(),
|
|
225
|
+
SupportDiscussions(),
|
|
226
|
+
SupportIssues(),
|
|
227
|
+
SupportProjects(),
|
|
228
|
+
SupportWikis(),
|
|
229
|
+
TemplateRepository(),
|
|
230
|
+
WebCommitSignoff(),
|
|
231
|
+
],
|
|
232
|
+
)
|
|
233
|
+
|
|
234
|
+
# ----------------------------------------------------------------------
|
|
235
|
+
@override
|
|
236
|
+
def GetData(
|
|
237
|
+
self,
|
|
238
|
+
module_data: dict[str, Any],
|
|
239
|
+
) -> Optional[dict[str, Any]]:
|
|
240
|
+
"""Get the data from an API session."""
|
|
241
|
+
response = module_data["session"].get("")
|
|
242
|
+
|
|
243
|
+
response.raise_for_status()
|
|
244
|
+
response = response.json()
|
|
245
|
+
|
|
246
|
+
module_data["standard"] = response
|
|
247
|
+
|
|
248
|
+
return module_data
|