mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 21:28:11 +09:00 
			
		
		
		
	* download endpoint has to use 302 redirect
* fake blob download used if direct download not possible
* downloading v3 artifacts not possible
New repo apis based on GitHub Rest V3
- GET /runs/{run}/artifacts (Cannot use run index of url due to not
being unique)
- GET /artifacts
- GET + DELETE /artifacts/{artifact_id}
- GET /artifacts/{artifact_id}/zip
- (GET /artifacts/{artifact_id}/zip/raw this is a workaround for a http
302 assertion in actions/toolkit)
- api docs removed this is protected by a signed url like the internal
artifacts api and no longer usable with any token or swagger
  - returns http 401 if the signature is invalid
    - or change the artifact id
    - or expired after 1 hour
Closes #33353
Closes #32124
---------
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
		
	
		
			
				
	
	
		
			99 lines
		
	
	
		
			3.0 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			99 lines
		
	
	
		
			3.0 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
| // Copyright 2023 The Gitea Authors. All rights reserved.
 | |
| // SPDX-License-Identifier: MIT
 | |
| 
 | |
| package structs
 | |
| 
 | |
| import (
 | |
| 	"time"
 | |
| )
 | |
| 
 | |
| // ActionTask represents a ActionTask
 | |
| type ActionTask struct {
 | |
| 	ID           int64  `json:"id"`
 | |
| 	Name         string `json:"name"`
 | |
| 	HeadBranch   string `json:"head_branch"`
 | |
| 	HeadSHA      string `json:"head_sha"`
 | |
| 	RunNumber    int64  `json:"run_number"`
 | |
| 	Event        string `json:"event"`
 | |
| 	DisplayTitle string `json:"display_title"`
 | |
| 	Status       string `json:"status"`
 | |
| 	WorkflowID   string `json:"workflow_id"`
 | |
| 	URL          string `json:"url"`
 | |
| 	// swagger:strfmt date-time
 | |
| 	CreatedAt time.Time `json:"created_at"`
 | |
| 	// swagger:strfmt date-time
 | |
| 	UpdatedAt time.Time `json:"updated_at"`
 | |
| 	// swagger:strfmt date-time
 | |
| 	RunStartedAt time.Time `json:"run_started_at"`
 | |
| }
 | |
| 
 | |
| // ActionTaskResponse returns a ActionTask
 | |
| type ActionTaskResponse struct {
 | |
| 	Entries    []*ActionTask `json:"workflow_runs"`
 | |
| 	TotalCount int64         `json:"total_count"`
 | |
| }
 | |
| 
 | |
| // CreateActionWorkflowDispatch represents the payload for triggering a workflow dispatch event
 | |
| // swagger:model
 | |
| type CreateActionWorkflowDispatch struct {
 | |
| 	// required: true
 | |
| 	// example: refs/heads/main
 | |
| 	Ref string `json:"ref" binding:"Required"`
 | |
| 	// required: false
 | |
| 	Inputs map[string]string `json:"inputs,omitempty"`
 | |
| }
 | |
| 
 | |
| // ActionWorkflow represents a ActionWorkflow
 | |
| type ActionWorkflow struct {
 | |
| 	ID    string `json:"id"`
 | |
| 	Name  string `json:"name"`
 | |
| 	Path  string `json:"path"`
 | |
| 	State string `json:"state"`
 | |
| 	// swagger:strfmt date-time
 | |
| 	CreatedAt time.Time `json:"created_at"`
 | |
| 	// swagger:strfmt date-time
 | |
| 	UpdatedAt time.Time `json:"updated_at"`
 | |
| 	URL       string    `json:"url"`
 | |
| 	HTMLURL   string    `json:"html_url"`
 | |
| 	BadgeURL  string    `json:"badge_url"`
 | |
| 	// swagger:strfmt date-time
 | |
| 	DeletedAt time.Time `json:"deleted_at,omitempty"`
 | |
| }
 | |
| 
 | |
| // ActionWorkflowResponse returns a ActionWorkflow
 | |
| type ActionWorkflowResponse struct {
 | |
| 	Workflows  []*ActionWorkflow `json:"workflows"`
 | |
| 	TotalCount int64             `json:"total_count"`
 | |
| }
 | |
| 
 | |
| // ActionArtifact represents a ActionArtifact
 | |
| type ActionArtifact struct {
 | |
| 	ID                 int64              `json:"id"`
 | |
| 	Name               string             `json:"name"`
 | |
| 	SizeInBytes        int64              `json:"size_in_bytes"`
 | |
| 	URL                string             `json:"url"`
 | |
| 	ArchiveDownloadURL string             `json:"archive_download_url"`
 | |
| 	Expired            bool               `json:"expired"`
 | |
| 	WorkflowRun        *ActionWorkflowRun `json:"workflow_run"`
 | |
| 
 | |
| 	// swagger:strfmt date-time
 | |
| 	CreatedAt time.Time `json:"created_at"`
 | |
| 	// swagger:strfmt date-time
 | |
| 	UpdatedAt time.Time `json:"updated_at"`
 | |
| 	// swagger:strfmt date-time
 | |
| 	ExpiresAt time.Time `json:"expires_at"`
 | |
| }
 | |
| 
 | |
| // ActionWorkflowRun represents a WorkflowRun
 | |
| type ActionWorkflowRun struct {
 | |
| 	ID           int64  `json:"id"`
 | |
| 	RepositoryID int64  `json:"repository_id"`
 | |
| 	HeadSha      string `json:"head_sha"`
 | |
| }
 | |
| 
 | |
| // ActionArtifactsResponse returns ActionArtifacts
 | |
| type ActionArtifactsResponse struct {
 | |
| 	Entries    []*ActionArtifact `json:"artifacts"`
 | |
| 	TotalCount int64             `json:"total_count"`
 | |
| }
 |