PyGithub-asyncio 3.0.0b1__py3-none-any.whl
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.
- githubasyncio/AccessToken.py +159 -0
- githubasyncio/AdvisoryBase.py +163 -0
- githubasyncio/AdvisoryCredit.py +131 -0
- githubasyncio/AdvisoryCreditDetailed.py +110 -0
- githubasyncio/AdvisoryVulnerability.py +191 -0
- githubasyncio/AdvisoryVulnerabilityPackage.py +93 -0
- githubasyncio/AppAuthentication.py +58 -0
- githubasyncio/ApplicationOAuth.py +200 -0
- githubasyncio/Artifact.py +183 -0
- githubasyncio/Auth.py +560 -0
- githubasyncio/AuthenticatedUser.py +1251 -0
- githubasyncio/Authorization.py +192 -0
- githubasyncio/AuthorizationApplication.py +73 -0
- githubasyncio/Autolink.py +104 -0
- githubasyncio/Branch.py +689 -0
- githubasyncio/BranchProtection.py +224 -0
- githubasyncio/CVSS.py +83 -0
- githubasyncio/CWE.py +75 -0
- githubasyncio/CheckRun.py +315 -0
- githubasyncio/CheckRunAnnotation.py +134 -0
- githubasyncio/CheckRunOutput.py +108 -0
- githubasyncio/CheckSuite.py +319 -0
- githubasyncio/Clones.py +97 -0
- githubasyncio/CodeScanAlert.py +215 -0
- githubasyncio/CodeScanAlertInstance.py +134 -0
- githubasyncio/CodeScanAlertInstanceLocation.py +102 -0
- githubasyncio/CodeScanRule.py +134 -0
- githubasyncio/CodeScanTool.py +94 -0
- githubasyncio/CodeSecurityConfig.py +301 -0
- githubasyncio/CodeSecurityConfigRepository.py +70 -0
- githubasyncio/Commit.py +442 -0
- githubasyncio/CommitCombinedStatus.py +126 -0
- githubasyncio/CommitComment.py +270 -0
- githubasyncio/CommitStats.py +78 -0
- githubasyncio/CommitStatus.py +169 -0
- githubasyncio/Comparison.py +219 -0
- githubasyncio/Consts.py +197 -0
- githubasyncio/ContentFile.py +304 -0
- githubasyncio/Copilot.py +97 -0
- githubasyncio/CopilotSeat.py +132 -0
- githubasyncio/DefaultCodeSecurityConfig.py +93 -0
- githubasyncio/DependabotAlert.py +184 -0
- githubasyncio/DependabotAlertAdvisory.py +82 -0
- githubasyncio/DependabotAlertDependency.py +100 -0
- githubasyncio/DependabotAlertVulnerability.py +85 -0
- githubasyncio/Deployment.py +314 -0
- githubasyncio/DeploymentBranchPolicy.py +102 -0
- githubasyncio/DeploymentStatus.py +201 -0
- githubasyncio/DiscussionBase.py +140 -0
- githubasyncio/DiscussionCommentBase.py +140 -0
- githubasyncio/Download.py +256 -0
- githubasyncio/Enterprise.py +175 -0
- githubasyncio/EnterpriseConsumedLicenses.py +138 -0
- githubasyncio/Environment.py +354 -0
- githubasyncio/EnvironmentDeploymentBranchPolicy.py +87 -0
- githubasyncio/EnvironmentProtectionRule.py +117 -0
- githubasyncio/EnvironmentProtectionRuleReviewer.py +110 -0
- githubasyncio/Event.py +134 -0
- githubasyncio/File.py +142 -0
- githubasyncio/GeneratedReleaseNotes.py +68 -0
- githubasyncio/Gist.py +373 -0
- githubasyncio/GistComment.py +162 -0
- githubasyncio/GistFile.py +106 -0
- githubasyncio/GistHistoryState.py +245 -0
- githubasyncio/GitAuthor.py +94 -0
- githubasyncio/GitBlob.py +123 -0
- githubasyncio/GitCommit.py +208 -0
- githubasyncio/GitCommitVerification.py +103 -0
- githubasyncio/GitObject.py +84 -0
- githubasyncio/GitRef.py +122 -0
- githubasyncio/GitRelease.py +476 -0
- githubasyncio/GitReleaseAsset.py +232 -0
- githubasyncio/GitTag.py +143 -0
- githubasyncio/GitTree.py +113 -0
- githubasyncio/GitTreeElement.py +104 -0
- githubasyncio/GithubApp.py +236 -0
- githubasyncio/GithubException.py +226 -0
- githubasyncio/GithubIntegration.py +365 -0
- githubasyncio/GithubObject.py +910 -0
- githubasyncio/GithubRetry.py +253 -0
- githubasyncio/GitignoreTemplate.py +88 -0
- githubasyncio/GlobalAdvisory.py +141 -0
- githubasyncio/Hook.py +238 -0
- githubasyncio/HookDelivery.py +243 -0
- githubasyncio/HookDescription.py +85 -0
- githubasyncio/HookResponse.py +83 -0
- githubasyncio/InputFileContent.py +63 -0
- githubasyncio/InputGitAuthor.py +71 -0
- githubasyncio/InputGitTreeElement.py +79 -0
- githubasyncio/Installation.py +298 -0
- githubasyncio/InstallationAuthorization.py +138 -0
- githubasyncio/Invitation.py +171 -0
- githubasyncio/Issue.py +955 -0
- githubasyncio/IssueComment.py +309 -0
- githubasyncio/IssueDependenciesSummary.py +77 -0
- githubasyncio/IssueEvent.py +296 -0
- githubasyncio/IssuePullRequest.py +97 -0
- githubasyncio/IssueType.py +123 -0
- githubasyncio/Label.py +186 -0
- githubasyncio/License.py +169 -0
- githubasyncio/MainClass.py +1142 -0
- githubasyncio/Membership.py +154 -0
- githubasyncio/MergedUpstream.py +71 -0
- githubasyncio/Migration.py +281 -0
- githubasyncio/Milestone.py +255 -0
- githubasyncio/NamedEnterpriseUser.py +207 -0
- githubasyncio/NamedUser.py +841 -0
- githubasyncio/Notification.py +182 -0
- githubasyncio/NotificationSubject.py +96 -0
- githubasyncio/Organization.py +2462 -0
- githubasyncio/OrganizationCodeScanAlert.py +65 -0
- githubasyncio/OrganizationCustomProperty.py +215 -0
- githubasyncio/OrganizationDependabotAlert.py +75 -0
- githubasyncio/OrganizationSecret.py +191 -0
- githubasyncio/OrganizationSecretScanAlert.py +112 -0
- githubasyncio/OrganizationVariable.py +141 -0
- githubasyncio/PaginatedList.py +652 -0
- githubasyncio/Path.py +102 -0
- githubasyncio/Permissions.py +113 -0
- githubasyncio/Plan.py +108 -0
- githubasyncio/Project.py +286 -0
- githubasyncio/ProjectCard.py +257 -0
- githubasyncio/ProjectColumn.py +227 -0
- githubasyncio/PublicKey.py +138 -0
- githubasyncio/PullRequest.py +1202 -0
- githubasyncio/PullRequestComment.py +401 -0
- githubasyncio/PullRequestMergeStatus.py +89 -0
- githubasyncio/PullRequestPart.py +110 -0
- githubasyncio/PullRequestReview.py +214 -0
- githubasyncio/Rate.py +123 -0
- githubasyncio/RateLimit.py +210 -0
- githubasyncio/RateLimitOverview.py +104 -0
- githubasyncio/Reaction.py +128 -0
- githubasyncio/Referrer.py +94 -0
- githubasyncio/RepoCodeSecurityConfig.py +93 -0
- githubasyncio/Repository.py +5211 -0
- githubasyncio/RepositoryAdvisory.py +431 -0
- githubasyncio/RepositoryDiscussion.py +221 -0
- githubasyncio/RepositoryDiscussionCategory.py +150 -0
- githubasyncio/RepositoryDiscussionComment.py +159 -0
- githubasyncio/RepositoryKey.py +166 -0
- githubasyncio/RepositoryPreferences.py +82 -0
- githubasyncio/RepositoryRulesetBypassActor.py +75 -0
- githubasyncio/Requester.py +1518 -0
- githubasyncio/RequiredPullRequestReviews.py +269 -0
- githubasyncio/RequiredStatusChecks.py +153 -0
- githubasyncio/Rule.py +134 -0
- githubasyncio/Ruleset.py +292 -0
- githubasyncio/Secret.py +139 -0
- githubasyncio/SecretScanAlert.py +317 -0
- githubasyncio/SecretScanAlertInstance.py +128 -0
- githubasyncio/SecurityAndAnalysis.py +188 -0
- githubasyncio/SecurityAndAnalysisFeature.py +79 -0
- githubasyncio/SelfHostedActionsRunner.py +129 -0
- githubasyncio/SelfHostedActionsRunnerApplication.py +92 -0
- githubasyncio/SelfHostedActionsRunnerJitConfig.py +74 -0
- githubasyncio/SelfHostedActionsRunnerToken.py +118 -0
- githubasyncio/SourceImport.py +260 -0
- githubasyncio/Stargazer.py +88 -0
- githubasyncio/StatsCodeFrequency.py +81 -0
- githubasyncio/StatsCommitActivity.py +86 -0
- githubasyncio/StatsContributor.py +138 -0
- githubasyncio/StatsParticipation.py +78 -0
- githubasyncio/StatsPunchCard.py +76 -0
- githubasyncio/SubIssueSummary.py +70 -0
- githubasyncio/Tag.py +108 -0
- githubasyncio/Team.py +618 -0
- githubasyncio/TeamDiscussion.py +137 -0
- githubasyncio/TimelineEvent.py +164 -0
- githubasyncio/TimelineEventSource.py +81 -0
- githubasyncio/Topic.py +177 -0
- githubasyncio/Traffic.py +95 -0
- githubasyncio/UserKey.py +141 -0
- githubasyncio/Variable.py +155 -0
- githubasyncio/View.py +97 -0
- githubasyncio/Workflow.py +335 -0
- githubasyncio/WorkflowJob.py +253 -0
- githubasyncio/WorkflowRun.py +480 -0
- githubasyncio/WorkflowStep.py +118 -0
- githubasyncio/__init__.py +38 -0
- githubasyncio/compat/__init__.py +52 -0
- githubasyncio/requestlib/__init__.py +29 -0
- pygithub_asyncio-3.0.0b1.dist-info/METADATA +102 -0
- pygithub_asyncio-3.0.0b1.dist-info/RECORD +188 -0
- pygithub_asyncio-3.0.0b1.dist-info/WHEEL +5 -0
- pygithub_asyncio-3.0.0b1.dist-info/licenses/COPYING +674 -0
- pygithub_asyncio-3.0.0b1.dist-info/licenses/COPYING.LESSER +165 -0
- pygithub_asyncio-3.0.0b1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
# FILE AUTO GENERATED DO NOT TOUCH
|
|
2
|
+
############################ Copyrights and license ############################
|
|
3
|
+
# #
|
|
4
|
+
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
|
5
|
+
# Copyright 2012 Zearin <zearin@gonk.net> #
|
|
6
|
+
# Copyright 2013 AKFish <akfish@gmail.com> #
|
|
7
|
+
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
|
8
|
+
# Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> #
|
|
9
|
+
# Copyright 2016 Jannis Gebauer <ja.geb@me.com> #
|
|
10
|
+
# Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> #
|
|
11
|
+
# Copyright 2017 Jannis Gebauer <ja.geb@me.com> #
|
|
12
|
+
# Copyright 2017 Simon <spam@esemi.ru> #
|
|
13
|
+
# Copyright 2018 sfdye <tsfdye@gmail.com> #
|
|
14
|
+
# Copyright 2019 Steve Kowalik <steven@wedontsleep.org> #
|
|
15
|
+
# Copyright 2019 Wan Liuyang <tsfdye@gmail.com> #
|
|
16
|
+
# Copyright 2020 Mahesh Raju <coder@mahesh.net> #
|
|
17
|
+
# Copyright 2020 Steve Kowalik <steven@wedontsleep.org> #
|
|
18
|
+
# Copyright 2021 Steve Kowalik <steven@wedontsleep.org> #
|
|
19
|
+
# Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
|
|
20
|
+
# Copyright 2023 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
|
21
|
+
# Copyright 2023 Thomas Burghout <thomas.burghout@nedap.com> #
|
|
22
|
+
# Copyright 2023 Trim21 <trim21.me@gmail.com> #
|
|
23
|
+
# Copyright 2023 sd-kialo <138505487+sd-kialo@users.noreply.github.com> #
|
|
24
|
+
# Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
|
|
25
|
+
# Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
|
26
|
+
# Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
|
|
27
|
+
# Copyright 2025 Nick McClorey <32378821+nickrmcclorey@users.noreply.github.com>#
|
|
28
|
+
# Copyright 2026 Denis Blanchette <dblanchette@coveo.com> #
|
|
29
|
+
# Copyright 2026 Enrico Minack <github@enrico.minack.dev> #
|
|
30
|
+
# Copyright 2026 Sebastien NICOT <sebastien.nicot@enterprisedb.com> #
|
|
31
|
+
# #
|
|
32
|
+
# This file is part of PyGithub. #
|
|
33
|
+
# http://pygithub.readthedocs.io/ #
|
|
34
|
+
# #
|
|
35
|
+
# PyGithub is free software: you can redistribute it and/or modify it under #
|
|
36
|
+
# the terms of the GNU Lesser General Public License as published by the Free #
|
|
37
|
+
# Software Foundation, either version 3 of the License, or (at your option) #
|
|
38
|
+
# any later version. #
|
|
39
|
+
# #
|
|
40
|
+
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
|
41
|
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
|
42
|
+
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
|
43
|
+
# details. #
|
|
44
|
+
# #
|
|
45
|
+
# You should have received a copy of the GNU Lesser General Public License #
|
|
46
|
+
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
|
47
|
+
# #
|
|
48
|
+
################################################################################
|
|
49
|
+
|
|
50
|
+
from __future__ import annotations
|
|
51
|
+
|
|
52
|
+
import json
|
|
53
|
+
from datetime import datetime
|
|
54
|
+
from typing import TYPE_CHECKING, Any, Literal, overload
|
|
55
|
+
|
|
56
|
+
import githubasyncio.Branch
|
|
57
|
+
import githubasyncio.GithubObject
|
|
58
|
+
import githubasyncio.NamedUser
|
|
59
|
+
import githubasyncio.Tag
|
|
60
|
+
import githubasyncio.WorkflowRun
|
|
61
|
+
from githubasyncio.GithubObject import (
|
|
62
|
+
Attribute,
|
|
63
|
+
CompletableGithubObject,
|
|
64
|
+
NotSet,
|
|
65
|
+
Opt,
|
|
66
|
+
ignore_return_type,
|
|
67
|
+
is_defined,
|
|
68
|
+
is_undefined,
|
|
69
|
+
)
|
|
70
|
+
from githubasyncio.PaginatedList import PaginatedList
|
|
71
|
+
|
|
72
|
+
if TYPE_CHECKING:
|
|
73
|
+
from githubasyncio.Branch import Branch
|
|
74
|
+
from githubasyncio.NamedUser import NamedUser
|
|
75
|
+
from githubasyncio.Tag import Tag
|
|
76
|
+
from githubasyncio.WorkflowRun import WorkflowRun
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
class Workflow(CompletableGithubObject):
|
|
80
|
+
"""
|
|
81
|
+
This class represents Workflows.
|
|
82
|
+
|
|
83
|
+
The reference can be found here
|
|
84
|
+
https://docs.github.com/en/rest/reference/actions#workflows
|
|
85
|
+
|
|
86
|
+
The OpenAPI schema can be found at
|
|
87
|
+
|
|
88
|
+
- /components/schemas/workflow
|
|
89
|
+
|
|
90
|
+
"""
|
|
91
|
+
|
|
92
|
+
def _initAttributes(self) -> None:
|
|
93
|
+
self._badge_url: Attribute[str] = NotSet
|
|
94
|
+
self._created_at: Attribute[datetime] = NotSet
|
|
95
|
+
self._deleted_at: Attribute[datetime] = NotSet
|
|
96
|
+
self._html_url: Attribute[str] = NotSet
|
|
97
|
+
self._id: Attribute[int] = NotSet
|
|
98
|
+
self._name: Attribute[str] = NotSet
|
|
99
|
+
self._node_id: Attribute[str] = NotSet
|
|
100
|
+
self._path: Attribute[str] = NotSet
|
|
101
|
+
self._state: Attribute[str] = NotSet
|
|
102
|
+
self._updated_at: Attribute[datetime] = NotSet
|
|
103
|
+
self._url: Attribute[str] = NotSet
|
|
104
|
+
|
|
105
|
+
def __repr__(self) -> str:
|
|
106
|
+
return self.get__repr__({"name": self._name.value, "url": self._url.value})
|
|
107
|
+
|
|
108
|
+
@property
|
|
109
|
+
async def badge_url(self) -> str:
|
|
110
|
+
await self._completeIfNotSet(self._badge_url)
|
|
111
|
+
return self._badge_url.value
|
|
112
|
+
|
|
113
|
+
@property
|
|
114
|
+
async def created_at(self) -> datetime:
|
|
115
|
+
await self._completeIfNotSet(self._created_at)
|
|
116
|
+
return self._created_at.value
|
|
117
|
+
|
|
118
|
+
@property
|
|
119
|
+
async def deleted_at(self) -> datetime:
|
|
120
|
+
await self._completeIfNotSet(self._deleted_at)
|
|
121
|
+
return self._deleted_at.value
|
|
122
|
+
|
|
123
|
+
@property
|
|
124
|
+
async def html_url(self) -> str:
|
|
125
|
+
await self._completeIfNotSet(self._html_url)
|
|
126
|
+
return self._html_url.value
|
|
127
|
+
|
|
128
|
+
@property
|
|
129
|
+
async def id(self) -> int:
|
|
130
|
+
await self._completeIfNotSet(self._id)
|
|
131
|
+
return self._id.value
|
|
132
|
+
|
|
133
|
+
@property
|
|
134
|
+
async def name(self) -> str:
|
|
135
|
+
await self._completeIfNotSet(self._name)
|
|
136
|
+
return self._name.value
|
|
137
|
+
|
|
138
|
+
@property
|
|
139
|
+
async def node_id(self) -> str:
|
|
140
|
+
await self._completeIfNotSet(self._node_id)
|
|
141
|
+
return self._node_id.value
|
|
142
|
+
|
|
143
|
+
@property
|
|
144
|
+
async def path(self) -> str:
|
|
145
|
+
await self._completeIfNotSet(self._path)
|
|
146
|
+
return self._path.value
|
|
147
|
+
|
|
148
|
+
@property
|
|
149
|
+
async def state(self) -> str:
|
|
150
|
+
await self._completeIfNotSet(self._state)
|
|
151
|
+
return self._state.value
|
|
152
|
+
|
|
153
|
+
@property
|
|
154
|
+
async def updated_at(self) -> datetime:
|
|
155
|
+
await self._completeIfNotSet(self._updated_at)
|
|
156
|
+
return self._updated_at.value
|
|
157
|
+
|
|
158
|
+
@property
|
|
159
|
+
async def url(self) -> str:
|
|
160
|
+
await self._completeIfNotSet(self._url)
|
|
161
|
+
return self._url.value
|
|
162
|
+
|
|
163
|
+
@overload
|
|
164
|
+
async def create_dispatch(
|
|
165
|
+
self,
|
|
166
|
+
ref: Branch | Tag | str,
|
|
167
|
+
inputs: Opt[dict] = NotSet,
|
|
168
|
+
throw: bool = False,
|
|
169
|
+
return_run_details: Literal[False] = ...,
|
|
170
|
+
) -> bool: ...
|
|
171
|
+
|
|
172
|
+
@overload
|
|
173
|
+
async def create_dispatch(
|
|
174
|
+
self,
|
|
175
|
+
ref: Branch | Tag | str,
|
|
176
|
+
inputs: Opt[dict] = NotSet,
|
|
177
|
+
throw: bool = False,
|
|
178
|
+
return_run_details: Literal[True] = ...,
|
|
179
|
+
) -> WorkflowRun: ...
|
|
180
|
+
|
|
181
|
+
# v3: default throw to True
|
|
182
|
+
@ignore_return_type(ignore_type="WorkflowRun")
|
|
183
|
+
async def create_dispatch(
|
|
184
|
+
self,
|
|
185
|
+
ref: Branch | Tag | str,
|
|
186
|
+
inputs: Opt[dict] = NotSet,
|
|
187
|
+
throw: bool = False,
|
|
188
|
+
return_run_details: bool = False,
|
|
189
|
+
) -> bool | WorkflowRun:
|
|
190
|
+
"""
|
|
191
|
+
:calls: `POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches <https://docs.github.com/en/rest/reference/actions#create-a-workflow-dispatch-event>`_
|
|
192
|
+
:param ref: :class:`githubasyncio.Branch.Branch` or :class:`githubasyncio.Tag.Tag` or string (branch or tag name)
|
|
193
|
+
Note: raises or return False without details on error, depending on the ``throw`` parameter.
|
|
194
|
+
"""
|
|
195
|
+
assert isinstance(ref, (githubasyncio.Branch.Branch, githubasyncio.Tag.Tag, str)), ref
|
|
196
|
+
assert is_undefined(inputs) or isinstance(inputs, dict), inputs
|
|
197
|
+
if isinstance(ref, githubasyncio.Branch.Branch):
|
|
198
|
+
ref = ref.name
|
|
199
|
+
elif isinstance(ref, githubasyncio.Tag.Tag):
|
|
200
|
+
ref = ref.name
|
|
201
|
+
if is_undefined(inputs):
|
|
202
|
+
inputs = {}
|
|
203
|
+
url = f"{await self.url}/dispatches"
|
|
204
|
+
input: dict[str, str | bool | dict] = NotSet.remove_unset_items({"ref": ref, "inputs": inputs})
|
|
205
|
+
|
|
206
|
+
# Add return_run_details to the request body if requested
|
|
207
|
+
if return_run_details:
|
|
208
|
+
input["return_run_details"] = True
|
|
209
|
+
|
|
210
|
+
if throw:
|
|
211
|
+
_, data = await self._requester.requestJsonAndCheck("POST", url, input=input)
|
|
212
|
+
if return_run_details and data:
|
|
213
|
+
# Map API response to WorkflowRun attributes
|
|
214
|
+
workflow_run_data = {
|
|
215
|
+
"id": data["workflow_run_id"],
|
|
216
|
+
"url": data["run_url"],
|
|
217
|
+
"html_url": data["html_url"],
|
|
218
|
+
}
|
|
219
|
+
return githubasyncio.WorkflowRun.WorkflowRun(
|
|
220
|
+
self._requester, headers={}, attributes=workflow_run_data, completed=False
|
|
221
|
+
)
|
|
222
|
+
return True
|
|
223
|
+
else:
|
|
224
|
+
status, _, data = await self._requester.requestJson("POST", url, input=input)
|
|
225
|
+
if return_run_details and status == 200 and data:
|
|
226
|
+
# Parse JSON and map API response to WorkflowRun attributes
|
|
227
|
+
run_data = json.loads(data)
|
|
228
|
+
workflow_run_data = {
|
|
229
|
+
"id": run_data["workflow_run_id"],
|
|
230
|
+
"url": run_data["run_url"],
|
|
231
|
+
"html_url": run_data["html_url"],
|
|
232
|
+
}
|
|
233
|
+
return githubasyncio.WorkflowRun.WorkflowRun(
|
|
234
|
+
self._requester, headers={}, attributes=workflow_run_data, completed=False
|
|
235
|
+
)
|
|
236
|
+
return status in (200, 204)
|
|
237
|
+
|
|
238
|
+
async def get_runs(
|
|
239
|
+
self,
|
|
240
|
+
actor: Opt[NamedUser | str] = NotSet,
|
|
241
|
+
branch: Opt[Branch | str] = NotSet,
|
|
242
|
+
event: Opt[str] = NotSet,
|
|
243
|
+
status: Opt[str] = NotSet,
|
|
244
|
+
created: Opt[str] = NotSet,
|
|
245
|
+
exclude_pull_requests: Opt[bool] = NotSet,
|
|
246
|
+
check_suite_id: Opt[int] = NotSet,
|
|
247
|
+
head_sha: Opt[str] = NotSet,
|
|
248
|
+
) -> PaginatedList[WorkflowRun]:
|
|
249
|
+
"""
|
|
250
|
+
:calls: `GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/runs <https://docs.github.com/en/rest/actions/workflow-runs?apiVersion=2022-11-28#list-workflow-runs-for-a-workflow>`_
|
|
251
|
+
"""
|
|
252
|
+
assert is_undefined(actor) or isinstance(actor, githubasyncio.NamedUser.NamedUser) or isinstance(actor, str), (
|
|
253
|
+
actor
|
|
254
|
+
)
|
|
255
|
+
assert is_undefined(branch) or isinstance(branch, githubasyncio.Branch.Branch) or isinstance(branch, str), (
|
|
256
|
+
branch
|
|
257
|
+
)
|
|
258
|
+
assert is_undefined(event) or isinstance(event, str), event
|
|
259
|
+
assert is_undefined(status) or isinstance(status, str), status
|
|
260
|
+
assert is_undefined(created) or isinstance(created, str), created
|
|
261
|
+
assert is_undefined(exclude_pull_requests) or isinstance(exclude_pull_requests, bool), exclude_pull_requests
|
|
262
|
+
assert is_undefined(check_suite_id) or isinstance(check_suite_id, int), check_suite_id
|
|
263
|
+
assert is_undefined(head_sha) or isinstance(head_sha, str), head_sha
|
|
264
|
+
url_parameters: dict[str, Any] = dict()
|
|
265
|
+
if is_defined(actor):
|
|
266
|
+
url_parameters["actor"] = (
|
|
267
|
+
(await actor._identity) if isinstance(actor, githubasyncio.NamedUser.NamedUser) else actor
|
|
268
|
+
)
|
|
269
|
+
if is_defined(branch):
|
|
270
|
+
url_parameters["branch"] = branch.name if isinstance(branch, githubasyncio.Branch.Branch) else branch
|
|
271
|
+
if is_defined(event):
|
|
272
|
+
url_parameters["event"] = event
|
|
273
|
+
if is_defined(status):
|
|
274
|
+
url_parameters["status"] = status
|
|
275
|
+
if is_defined(created):
|
|
276
|
+
url_parameters["created"] = created
|
|
277
|
+
if is_defined(exclude_pull_requests):
|
|
278
|
+
url_parameters["exclude_pull_requests"] = exclude_pull_requests
|
|
279
|
+
if is_defined(check_suite_id):
|
|
280
|
+
url_parameters["check_suite_id"] = check_suite_id
|
|
281
|
+
if is_defined(head_sha):
|
|
282
|
+
url_parameters["head_sha"] = head_sha
|
|
283
|
+
|
|
284
|
+
return PaginatedList(
|
|
285
|
+
githubasyncio.WorkflowRun.WorkflowRun,
|
|
286
|
+
self._requester,
|
|
287
|
+
f"{await self.url}/runs",
|
|
288
|
+
url_parameters,
|
|
289
|
+
headers=None,
|
|
290
|
+
list_item="workflow_runs",
|
|
291
|
+
)
|
|
292
|
+
|
|
293
|
+
async def disable(self) -> bool:
|
|
294
|
+
"""
|
|
295
|
+
:calls: `PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/disable <https://docs.github.com/en/rest/actions/workflows?apiVersion=2022-11-28#disable-a-workflow>`_
|
|
296
|
+
:rtype: bool
|
|
297
|
+
"""
|
|
298
|
+
status, _, _ = await self._requester.requestJson("PUT", f"{await self.url}/disable")
|
|
299
|
+
return status == 204
|
|
300
|
+
|
|
301
|
+
async def enable(self) -> bool:
|
|
302
|
+
"""
|
|
303
|
+
:calls: `PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/enable <https://docs.github.com/en/rest/actions/workflows?apiVersion=2022-11-28#enable-a-workflow>`_
|
|
304
|
+
:rtype: bool
|
|
305
|
+
"""
|
|
306
|
+
status, _, _ = await self._requester.requestJson("PUT", f"{await self.url}/enable")
|
|
307
|
+
return status == 204
|
|
308
|
+
|
|
309
|
+
def _useAttributes(self, attributes: dict[str, Any]) -> None:
|
|
310
|
+
if "badge_url" in attributes: # pragma no branch
|
|
311
|
+
self._badge_url = self._makeStringAttribute(attributes["badge_url"])
|
|
312
|
+
if "created_at" in attributes: # pragma no branch
|
|
313
|
+
self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
|
|
314
|
+
if "deleted_at" in attributes: # pragma no branch
|
|
315
|
+
self._deleted_at = self._makeDatetimeAttribute(attributes["deleted_at"])
|
|
316
|
+
if "html_url" in attributes: # pragma no branch
|
|
317
|
+
self._html_url = self._makeStringAttribute(attributes["html_url"])
|
|
318
|
+
if "id" in attributes: # pragma no branch
|
|
319
|
+
self._id = self._makeIntAttribute(attributes["id"])
|
|
320
|
+
elif "url" in attributes and attributes["url"]:
|
|
321
|
+
id = attributes["url"].split("/")[-1]
|
|
322
|
+
if id.isnumeric():
|
|
323
|
+
self._id = self._makeIntAttribute(int(id))
|
|
324
|
+
if "name" in attributes: # pragma no branch
|
|
325
|
+
self._name = self._makeStringAttribute(attributes["name"])
|
|
326
|
+
if "node_id" in attributes: # pragma no branch
|
|
327
|
+
self._node_id = self._makeStringAttribute(attributes["node_id"])
|
|
328
|
+
if "path" in attributes: # pragma no branch
|
|
329
|
+
self._path = self._makeStringAttribute(attributes["path"])
|
|
330
|
+
if "state" in attributes: # pragma no branch
|
|
331
|
+
self._state = self._makeStringAttribute(attributes["state"])
|
|
332
|
+
if "updated_at" in attributes: # pragma no branch
|
|
333
|
+
self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"])
|
|
334
|
+
if "url" in attributes: # pragma no branch
|
|
335
|
+
self._url = self._makeStringAttribute(attributes["url"])
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
# FILE AUTO GENERATED DO NOT TOUCH
|
|
2
|
+
############################ Copyrights and license ############################
|
|
3
|
+
# #
|
|
4
|
+
# Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
|
|
5
|
+
# Copyright 2023 Jeppe Fihl-Pearson <tenzer@tenzer.dk> #
|
|
6
|
+
# Copyright 2023 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
|
7
|
+
# Copyright 2023 Trim21 <trim21.me@gmail.com> #
|
|
8
|
+
# Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
|
|
9
|
+
# Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
|
10
|
+
# Copyright 2024 Xavi Vega <xabi1309@gmail.com> #
|
|
11
|
+
# Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
|
|
12
|
+
# Copyright 2025 Yossi Rozantsev <54272821+Apakottur@users.noreply.github.com> #
|
|
13
|
+
# Copyright 2026 Chinedum Echeta <60179183+cecheta@users.noreply.github.com> #
|
|
14
|
+
# Copyright 2026 Enrico Minack <github@enrico.minack.dev> #
|
|
15
|
+
# #
|
|
16
|
+
# This file is part of PyGithub. #
|
|
17
|
+
# http://pygithub.readthedocs.io/ #
|
|
18
|
+
# #
|
|
19
|
+
# PyGithub is free software: you can redistribute it and/or modify it under #
|
|
20
|
+
# the terms of the GNU Lesser General Public License as published by the Free #
|
|
21
|
+
# Software Foundation, either version 3 of the License, or (at your option) #
|
|
22
|
+
# any later version. #
|
|
23
|
+
# #
|
|
24
|
+
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
|
25
|
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
|
26
|
+
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
|
27
|
+
# details. #
|
|
28
|
+
# #
|
|
29
|
+
# You should have received a copy of the GNU Lesser General Public License #
|
|
30
|
+
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
|
31
|
+
# #
|
|
32
|
+
################################################################################
|
|
33
|
+
|
|
34
|
+
from __future__ import annotations
|
|
35
|
+
|
|
36
|
+
from datetime import datetime
|
|
37
|
+
from typing import TYPE_CHECKING, Any
|
|
38
|
+
|
|
39
|
+
import githubasyncio.GithubObject
|
|
40
|
+
import githubasyncio.WorkflowStep
|
|
41
|
+
from githubasyncio.GithubObject import Attribute, CompletableGithubObject, NotSet
|
|
42
|
+
|
|
43
|
+
if TYPE_CHECKING:
|
|
44
|
+
from githubasyncio.WorkflowStep import WorkflowStep
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
class WorkflowJob(CompletableGithubObject):
|
|
48
|
+
"""
|
|
49
|
+
This class represents Workflow Jobs.
|
|
50
|
+
|
|
51
|
+
The reference can be found here
|
|
52
|
+
https://docs.github.com/en/rest/reference/actions#workflow-jobs
|
|
53
|
+
|
|
54
|
+
The OpenAPI schema can be found at
|
|
55
|
+
|
|
56
|
+
- /components/schemas/job
|
|
57
|
+
|
|
58
|
+
"""
|
|
59
|
+
|
|
60
|
+
def _initAttributes(self) -> None:
|
|
61
|
+
self._check_run_url: Attribute[str] = NotSet
|
|
62
|
+
self._completed_at: Attribute[datetime] = NotSet
|
|
63
|
+
self._conclusion: Attribute[str | None] = NotSet
|
|
64
|
+
self._created_at: Attribute[datetime] = NotSet
|
|
65
|
+
self._head_branch: Attribute[str] = NotSet
|
|
66
|
+
self._head_sha: Attribute[str] = NotSet
|
|
67
|
+
self._html_url: Attribute[str] = NotSet
|
|
68
|
+
self._id: Attribute[int] = NotSet
|
|
69
|
+
self._labels: Attribute[list[str]] = NotSet
|
|
70
|
+
self._name: Attribute[str] = NotSet
|
|
71
|
+
self._node_id: Attribute[str] = NotSet
|
|
72
|
+
self._run_attempt: Attribute[int] = NotSet
|
|
73
|
+
self._run_id: Attribute[int] = NotSet
|
|
74
|
+
self._run_url: Attribute[str] = NotSet
|
|
75
|
+
self._runner_group_id: Attribute[int] = NotSet
|
|
76
|
+
self._runner_group_name: Attribute[str] = NotSet
|
|
77
|
+
self._runner_id: Attribute[int] = NotSet
|
|
78
|
+
self._runner_name: Attribute[str] = NotSet
|
|
79
|
+
self._started_at: Attribute[datetime] = NotSet
|
|
80
|
+
self._status: Attribute[str] = NotSet
|
|
81
|
+
self._steps: Attribute[list[WorkflowStep]] = NotSet
|
|
82
|
+
self._url: Attribute[str] = NotSet
|
|
83
|
+
self._workflow_name: Attribute[str] = NotSet
|
|
84
|
+
|
|
85
|
+
def __repr__(self) -> str:
|
|
86
|
+
return self.get__repr__({"id": self._id.value, "url": self._url.value})
|
|
87
|
+
|
|
88
|
+
@property
|
|
89
|
+
async def check_run_url(self) -> str:
|
|
90
|
+
await self._completeIfNotSet(self._check_run_url)
|
|
91
|
+
return self._check_run_url.value
|
|
92
|
+
|
|
93
|
+
@property
|
|
94
|
+
async def completed_at(self) -> datetime:
|
|
95
|
+
await self._completeIfNotSet(self._completed_at)
|
|
96
|
+
return self._completed_at.value
|
|
97
|
+
|
|
98
|
+
@property
|
|
99
|
+
async def conclusion(self) -> str | None:
|
|
100
|
+
await self._completeIfNotSet(self._conclusion)
|
|
101
|
+
return self._conclusion.value
|
|
102
|
+
|
|
103
|
+
@property
|
|
104
|
+
async def created_at(self) -> datetime:
|
|
105
|
+
await self._completeIfNotSet(self._created_at)
|
|
106
|
+
return self._created_at.value
|
|
107
|
+
|
|
108
|
+
@property
|
|
109
|
+
async def head_branch(self) -> str:
|
|
110
|
+
await self._completeIfNotSet(self._head_branch)
|
|
111
|
+
return self._head_branch.value
|
|
112
|
+
|
|
113
|
+
@property
|
|
114
|
+
async def head_sha(self) -> str:
|
|
115
|
+
await self._completeIfNotSet(self._head_sha)
|
|
116
|
+
return self._head_sha.value
|
|
117
|
+
|
|
118
|
+
@property
|
|
119
|
+
async def html_url(self) -> str:
|
|
120
|
+
await self._completeIfNotSet(self._html_url)
|
|
121
|
+
return self._html_url.value
|
|
122
|
+
|
|
123
|
+
@property
|
|
124
|
+
async def id(self) -> int:
|
|
125
|
+
await self._completeIfNotSet(self._id)
|
|
126
|
+
return self._id.value
|
|
127
|
+
|
|
128
|
+
@property
|
|
129
|
+
async def labels(self) -> list[str]:
|
|
130
|
+
await self._completeIfNotSet(self._labels)
|
|
131
|
+
return self._labels.value
|
|
132
|
+
|
|
133
|
+
@property
|
|
134
|
+
async def name(self) -> str:
|
|
135
|
+
await self._completeIfNotSet(self._name)
|
|
136
|
+
return self._name.value
|
|
137
|
+
|
|
138
|
+
@property
|
|
139
|
+
async def node_id(self) -> str:
|
|
140
|
+
await self._completeIfNotSet(self._node_id)
|
|
141
|
+
return self._node_id.value
|
|
142
|
+
|
|
143
|
+
@property
|
|
144
|
+
async def run_attempt(self) -> int:
|
|
145
|
+
await self._completeIfNotSet(self._run_attempt)
|
|
146
|
+
return self._run_attempt.value
|
|
147
|
+
|
|
148
|
+
@property
|
|
149
|
+
async def run_id(self) -> int:
|
|
150
|
+
await self._completeIfNotSet(self._run_id)
|
|
151
|
+
return self._run_id.value
|
|
152
|
+
|
|
153
|
+
@property
|
|
154
|
+
async def run_url(self) -> str:
|
|
155
|
+
await self._completeIfNotSet(self._run_url)
|
|
156
|
+
return self._run_url.value
|
|
157
|
+
|
|
158
|
+
@property
|
|
159
|
+
async def runner_group_id(self) -> int:
|
|
160
|
+
await self._completeIfNotSet(self._runner_group_id)
|
|
161
|
+
return self._runner_group_id.value
|
|
162
|
+
|
|
163
|
+
@property
|
|
164
|
+
async def runner_group_name(self) -> str:
|
|
165
|
+
await self._completeIfNotSet(self._runner_group_name)
|
|
166
|
+
return self._runner_group_name.value
|
|
167
|
+
|
|
168
|
+
@property
|
|
169
|
+
async def runner_id(self) -> int:
|
|
170
|
+
await self._completeIfNotSet(self._runner_id)
|
|
171
|
+
return self._runner_id.value
|
|
172
|
+
|
|
173
|
+
@property
|
|
174
|
+
async def runner_name(self) -> str:
|
|
175
|
+
await self._completeIfNotSet(self._runner_name)
|
|
176
|
+
return self._runner_name.value
|
|
177
|
+
|
|
178
|
+
@property
|
|
179
|
+
async def started_at(self) -> datetime:
|
|
180
|
+
await self._completeIfNotSet(self._started_at)
|
|
181
|
+
return self._started_at.value
|
|
182
|
+
|
|
183
|
+
@property
|
|
184
|
+
async def status(self) -> str:
|
|
185
|
+
await self._completeIfNotSet(self._status)
|
|
186
|
+
return self._status.value
|
|
187
|
+
|
|
188
|
+
@property
|
|
189
|
+
async def steps(self) -> list[WorkflowStep]:
|
|
190
|
+
await self._completeIfNotSet(self._steps)
|
|
191
|
+
return self._steps.value
|
|
192
|
+
|
|
193
|
+
@property
|
|
194
|
+
async def url(self) -> str:
|
|
195
|
+
await self._completeIfNotSet(self._url)
|
|
196
|
+
return self._url.value
|
|
197
|
+
|
|
198
|
+
@property
|
|
199
|
+
async def workflow_name(self) -> str:
|
|
200
|
+
await self._completeIfNotSet(self._workflow_name)
|
|
201
|
+
return self._workflow_name.value
|
|
202
|
+
|
|
203
|
+
async def logs_url(self) -> str:
|
|
204
|
+
headers, _ = await self._requester.requestBlobAndCheck("GET", f"{await self.url}/logs")
|
|
205
|
+
return headers["location"]
|
|
206
|
+
|
|
207
|
+
def _useAttributes(self, attributes: dict[str, Any]) -> None:
|
|
208
|
+
if "check_run_url" in attributes: # pragma no branch
|
|
209
|
+
self._check_run_url = self._makeStringAttribute(attributes["check_run_url"])
|
|
210
|
+
if "completed_at" in attributes: # pragma no branch
|
|
211
|
+
self._completed_at = self._makeDatetimeAttribute(attributes["completed_at"])
|
|
212
|
+
if "conclusion" in attributes: # pragma no branch
|
|
213
|
+
self._conclusion = self._makeStringAttribute(attributes["conclusion"])
|
|
214
|
+
if "created_at" in attributes: # pragma no branch
|
|
215
|
+
self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
|
|
216
|
+
if "head_branch" in attributes: # pragma no branch
|
|
217
|
+
self._head_branch = self._makeStringAttribute(attributes["head_branch"])
|
|
218
|
+
if "head_sha" in attributes: # pragma no branch
|
|
219
|
+
self._head_sha = self._makeStringAttribute(attributes["head_sha"])
|
|
220
|
+
if "html_url" in attributes: # pragma no branch
|
|
221
|
+
self._html_url = self._makeStringAttribute(attributes["html_url"])
|
|
222
|
+
if "id" in attributes: # pragma no branch
|
|
223
|
+
self._id = self._makeIntAttribute(attributes["id"])
|
|
224
|
+
if "labels" in attributes: # pragma no branch
|
|
225
|
+
self._labels = self._makeListOfStringsAttribute(attributes["labels"])
|
|
226
|
+
if "name" in attributes: # pragma no branch
|
|
227
|
+
self._name = self._makeStringAttribute(attributes["name"])
|
|
228
|
+
if "node_id" in attributes: # pragma no branch
|
|
229
|
+
self._node_id = self._makeStringAttribute(attributes["node_id"])
|
|
230
|
+
if "run_attempt" in attributes: # pragma no branch
|
|
231
|
+
self._run_attempt = self._makeIntAttribute(attributes["run_attempt"])
|
|
232
|
+
if "run_id" in attributes: # pragma no branch
|
|
233
|
+
self._run_id = self._makeIntAttribute(attributes["run_id"])
|
|
234
|
+
if "run_url" in attributes: # pragma no branch
|
|
235
|
+
self._run_url = self._makeStringAttribute(attributes["run_url"])
|
|
236
|
+
if "runner_group_id" in attributes: # pragma no branch
|
|
237
|
+
self._runner_group_id = self._makeIntAttribute(attributes["runner_group_id"])
|
|
238
|
+
if "runner_group_name" in attributes: # pragma no branch
|
|
239
|
+
self._runner_group_name = self._makeStringAttribute(attributes["runner_group_name"])
|
|
240
|
+
if "runner_id" in attributes: # pragma no branch
|
|
241
|
+
self._runner_id = self._makeIntAttribute(attributes["runner_id"])
|
|
242
|
+
if "runner_name" in attributes: # pragma no branch
|
|
243
|
+
self._runner_name = self._makeStringAttribute(attributes["runner_name"])
|
|
244
|
+
if "started_at" in attributes: # pragma no branch
|
|
245
|
+
self._started_at = self._makeDatetimeAttribute(attributes["started_at"])
|
|
246
|
+
if "status" in attributes: # pragma no branch
|
|
247
|
+
self._status = self._makeStringAttribute(attributes["status"])
|
|
248
|
+
if "steps" in attributes: # pragma no branch
|
|
249
|
+
self._steps = self._makeListOfClassesAttribute(githubasyncio.WorkflowStep.WorkflowStep, attributes["steps"])
|
|
250
|
+
if "url" in attributes: # pragma no branch
|
|
251
|
+
self._url = self._makeStringAttribute(attributes["url"])
|
|
252
|
+
if "workflow_name" in attributes: # pragma no branch
|
|
253
|
+
self._workflow_name = self._makeStringAttribute(attributes["workflow_name"])
|