gitea源码

repo_actions.go 7.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. // Copyright 2023 The Gitea Authors. All rights reserved.
  2. // SPDX-License-Identifier: MIT
  3. package structs
  4. import (
  5. "time"
  6. )
  7. // ActionTask represents a ActionTask
  8. type ActionTask struct {
  9. // ID is the unique identifier for the action task
  10. ID int64 `json:"id"`
  11. // Name is the name of the workflow
  12. Name string `json:"name"`
  13. // HeadBranch is the branch that triggered the workflow
  14. HeadBranch string `json:"head_branch"`
  15. // HeadSHA is the commit SHA that triggered the workflow
  16. HeadSHA string `json:"head_sha"`
  17. // RunNumber is the sequential number of the workflow run
  18. RunNumber int64 `json:"run_number"`
  19. // Event is the type of event that triggered the workflow
  20. Event string `json:"event"`
  21. // DisplayTitle is the display title for the workflow run
  22. DisplayTitle string `json:"display_title"`
  23. // Status indicates the current status of the workflow run
  24. Status string `json:"status"`
  25. // WorkflowID is the identifier of the workflow
  26. WorkflowID string `json:"workflow_id"`
  27. // URL is the API URL for this workflow run
  28. URL string `json:"url"`
  29. // swagger:strfmt date-time
  30. CreatedAt time.Time `json:"created_at"`
  31. // swagger:strfmt date-time
  32. UpdatedAt time.Time `json:"updated_at"`
  33. // swagger:strfmt date-time
  34. RunStartedAt time.Time `json:"run_started_at"`
  35. }
  36. // ActionTaskResponse returns a ActionTask
  37. type ActionTaskResponse struct {
  38. // Entries contains the list of workflow runs
  39. Entries []*ActionTask `json:"workflow_runs"`
  40. // TotalCount is the total number of workflow runs
  41. TotalCount int64 `json:"total_count"`
  42. }
  43. // CreateActionWorkflowDispatch represents the payload for triggering a workflow dispatch event
  44. // swagger:model
  45. type CreateActionWorkflowDispatch struct {
  46. // required: true
  47. // example: refs/heads/main
  48. Ref string `json:"ref" binding:"Required"`
  49. // required: false
  50. Inputs map[string]string `json:"inputs,omitempty"`
  51. }
  52. // ActionWorkflow represents a ActionWorkflow
  53. type ActionWorkflow struct {
  54. // ID is the unique identifier for the workflow
  55. ID string `json:"id"`
  56. // Name is the name of the workflow
  57. Name string `json:"name"`
  58. // Path is the file path of the workflow
  59. Path string `json:"path"`
  60. // State indicates if the workflow is active or disabled
  61. State string `json:"state"`
  62. // swagger:strfmt date-time
  63. CreatedAt time.Time `json:"created_at"`
  64. // swagger:strfmt date-time
  65. UpdatedAt time.Time `json:"updated_at"`
  66. // URL is the API URL for this workflow
  67. URL string `json:"url"`
  68. // HTMLURL is the web URL for viewing the workflow
  69. HTMLURL string `json:"html_url"`
  70. // BadgeURL is the URL for the workflow badge
  71. BadgeURL string `json:"badge_url"`
  72. // swagger:strfmt date-time
  73. DeletedAt time.Time `json:"deleted_at"`
  74. }
  75. // ActionWorkflowResponse returns a ActionWorkflow
  76. type ActionWorkflowResponse struct {
  77. Workflows []*ActionWorkflow `json:"workflows"`
  78. TotalCount int64 `json:"total_count"`
  79. }
  80. // ActionArtifact represents a ActionArtifact
  81. type ActionArtifact struct {
  82. ID int64 `json:"id"`
  83. Name string `json:"name"`
  84. SizeInBytes int64 `json:"size_in_bytes"`
  85. URL string `json:"url"`
  86. ArchiveDownloadURL string `json:"archive_download_url"`
  87. Expired bool `json:"expired"`
  88. WorkflowRun *ActionWorkflowRun `json:"workflow_run"`
  89. // swagger:strfmt date-time
  90. CreatedAt time.Time `json:"created_at"`
  91. // swagger:strfmt date-time
  92. UpdatedAt time.Time `json:"updated_at"`
  93. // swagger:strfmt date-time
  94. ExpiresAt time.Time `json:"expires_at"`
  95. }
  96. // ActionWorkflowRun represents a WorkflowRun
  97. type ActionWorkflowRun struct {
  98. ID int64 `json:"id"`
  99. URL string `json:"url"`
  100. HTMLURL string `json:"html_url"`
  101. DisplayTitle string `json:"display_title"`
  102. Path string `json:"path"`
  103. Event string `json:"event"`
  104. RunAttempt int64 `json:"run_attempt"`
  105. RunNumber int64 `json:"run_number"`
  106. RepositoryID int64 `json:"repository_id,omitempty"`
  107. HeadSha string `json:"head_sha"`
  108. HeadBranch string `json:"head_branch,omitempty"`
  109. Status string `json:"status"`
  110. Actor *User `json:"actor,omitempty"`
  111. TriggerActor *User `json:"trigger_actor,omitempty"`
  112. Repository *Repository `json:"repository,omitempty"`
  113. HeadRepository *Repository `json:"head_repository,omitempty"`
  114. Conclusion string `json:"conclusion,omitempty"`
  115. // swagger:strfmt date-time
  116. StartedAt time.Time `json:"started_at"`
  117. // swagger:strfmt date-time
  118. CompletedAt time.Time `json:"completed_at"`
  119. }
  120. // ActionWorkflowRunsResponse returns ActionWorkflowRuns
  121. type ActionWorkflowRunsResponse struct {
  122. Entries []*ActionWorkflowRun `json:"workflow_runs"`
  123. TotalCount int64 `json:"total_count"`
  124. }
  125. // ActionWorkflowJobsResponse returns ActionWorkflowJobs
  126. type ActionWorkflowJobsResponse struct {
  127. Entries []*ActionWorkflowJob `json:"jobs"`
  128. TotalCount int64 `json:"total_count"`
  129. }
  130. // ActionArtifactsResponse returns ActionArtifacts
  131. type ActionArtifactsResponse struct {
  132. Entries []*ActionArtifact `json:"artifacts"`
  133. TotalCount int64 `json:"total_count"`
  134. }
  135. // ActionWorkflowStep represents a step of a WorkflowJob
  136. type ActionWorkflowStep struct {
  137. Name string `json:"name"`
  138. Number int64 `json:"number"`
  139. Status string `json:"status"`
  140. Conclusion string `json:"conclusion,omitempty"`
  141. // swagger:strfmt date-time
  142. StartedAt time.Time `json:"started_at"`
  143. // swagger:strfmt date-time
  144. CompletedAt time.Time `json:"completed_at"`
  145. }
  146. // ActionWorkflowJob represents a WorkflowJob
  147. type ActionWorkflowJob struct {
  148. ID int64 `json:"id"`
  149. URL string `json:"url"`
  150. HTMLURL string `json:"html_url"`
  151. RunID int64 `json:"run_id"`
  152. RunURL string `json:"run_url"`
  153. Name string `json:"name"`
  154. Labels []string `json:"labels"`
  155. RunAttempt int64 `json:"run_attempt"`
  156. HeadSha string `json:"head_sha"`
  157. HeadBranch string `json:"head_branch,omitempty"`
  158. Status string `json:"status"`
  159. Conclusion string `json:"conclusion,omitempty"`
  160. RunnerID int64 `json:"runner_id,omitempty"`
  161. RunnerName string `json:"runner_name,omitempty"`
  162. Steps []*ActionWorkflowStep `json:"steps"`
  163. // swagger:strfmt date-time
  164. CreatedAt time.Time `json:"created_at"`
  165. // swagger:strfmt date-time
  166. StartedAt time.Time `json:"started_at"`
  167. // swagger:strfmt date-time
  168. CompletedAt time.Time `json:"completed_at"`
  169. }
  170. // ActionRunnerLabel represents a Runner Label
  171. type ActionRunnerLabel struct {
  172. ID int64 `json:"id"`
  173. Name string `json:"name"`
  174. Type string `json:"type"`
  175. }
  176. // ActionRunner represents a Runner
  177. type ActionRunner struct {
  178. ID int64 `json:"id"`
  179. Name string `json:"name"`
  180. Status string `json:"status"`
  181. Busy bool `json:"busy"`
  182. Ephemeral bool `json:"ephemeral"`
  183. Labels []*ActionRunnerLabel `json:"labels"`
  184. }
  185. // ActionRunnersResponse returns Runners
  186. type ActionRunnersResponse struct {
  187. Entries []*ActionRunner `json:"runners"`
  188. TotalCount int64 `json:"total_count"`
  189. }