Add code scanning alerts (#2227)

This commit is contained in:
Eric Nieuwland
2022-11-09 14:59:34 +08:00
committed by GitHub
parent 948edc5bb3
commit 7902351d4f
14 changed files with 982 additions and 0 deletions
+14
View File
@@ -66,6 +66,7 @@
# Copyright 2018 Leying Chen <leyingc@andrew.cmu.edu> #
# Copyright 2020 Pascal Hofmann <mail@pascalhofmann.de> #
# Copyright 2022 Aleksei Fedotov <aleksei@fedotov.email> #
# Copyright 2022 Eric Nieuwland <eric.nieuwland@gmail.com> #
# #
# This file is part of PyGithub. #
# http://pygithub.readthedocs.io/ #
@@ -98,6 +99,7 @@ import github.Branch
import github.CheckRun
import github.CheckSuite
import github.Clones
import github.CodeScanAlert
import github.Commit
import github.CommitComment
import github.Comparison
@@ -3772,6 +3774,18 @@ class Repository(github.GithubObject.CompletableGithubObject):
return github.Artifact.Artifact(self._requester, headers, data, completed=True)
def get_codescan_alerts(self):
"""
:calls: `GET https://api.github.com/repos/{owner}/{repo}/code-scanning/alerts <https://docs.github.com/en/rest/reference/code-scanning#list-code-scanning-alerts-for-a-repository>`_
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.CodeScanAlert.CodeScanAlert`
"""
return github.PaginatedList.PaginatedList(
github.CodeScanAlert.CodeScanAlert,
self._requester,
f"{self.url}/code-scanning/alerts",
None,
)
def _initAttributes(self):
self._allow_merge_commit = github.GithubObject.NotSet
self._allow_rebase_merge = github.GithubObject.NotSet