Skip to content

Commit f47debd

Browse files
authored
Merge branch 'master' into #2579
2 parents 68995d1 + c855eb5 commit f47debd

File tree

5 files changed

+355
-11
lines changed

5 files changed

+355
-11
lines changed

github/actions_artifacts.go

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,34 @@ import (
1212
"net/url"
1313
)
1414

15-
// Artifact reprents a GitHub artifact. Artifacts allow sharing
15+
// ArtifactWorkflowRun represents a GitHub artifact's workflow run.
16+
//
17+
// GitHub API docs: https://docs.github.com/en/rest/actions/artifacts
18+
type ArtifactWorkflowRun struct {
19+
ID *int64 `json:"id,omitempty"`
20+
RepositoryID *int64 `json:"repository_id,omitempty"`
21+
HeadRepositoryID *int64 `json:"head_repository_id,omitempty"`
22+
HeadBranch *string `json:"head_branch,omitempty"`
23+
HeadSHA *string `json:"head_sha,omitempty"`
24+
}
25+
26+
// Artifact represents a GitHub artifact. Artifacts allow sharing
1627
// data between jobs in a workflow and provide storage for data
1728
// once a workflow is complete.
1829
//
1930
// GitHub API docs: https://docs.github.com/en/rest/actions/artifacts
2031
type Artifact struct {
21-
ID *int64 `json:"id,omitempty"`
22-
NodeID *string `json:"node_id,omitempty"`
23-
Name *string `json:"name,omitempty"`
24-
SizeInBytes *int64 `json:"size_in_bytes,omitempty"`
25-
ArchiveDownloadURL *string `json:"archive_download_url,omitempty"`
26-
Expired *bool `json:"expired,omitempty"`
27-
CreatedAt *Timestamp `json:"created_at,omitempty"`
28-
ExpiresAt *Timestamp `json:"expires_at,omitempty"`
32+
ID *int64 `json:"id,omitempty"`
33+
NodeID *string `json:"node_id,omitempty"`
34+
Name *string `json:"name,omitempty"`
35+
SizeInBytes *int64 `json:"size_in_bytes,omitempty"`
36+
URL *string `json:"url,omitempty"`
37+
ArchiveDownloadURL *string `json:"archive_download_url,omitempty"`
38+
Expired *bool `json:"expired,omitempty"`
39+
CreatedAt *Timestamp `json:"created_at,omitempty"`
40+
UpdatedAt *Timestamp `json:"updated_at,omitempty"`
41+
ExpiresAt *Timestamp `json:"expires_at,omitempty"`
42+
WorkflowRun *ArtifactWorkflowRun `json:"workflow_run,omitempty"`
2943
}
3044

3145
// ArtifactList represents a list of GitHub artifacts.

github/actions_artifacts_test.go

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,21 +438,39 @@ func TestArtifact_Marshal(t *testing.T) {
438438
NodeID: String("nid"),
439439
Name: String("n"),
440440
SizeInBytes: Int64(1),
441+
URL: String("u"),
441442
ArchiveDownloadURL: String("a"),
442443
Expired: Bool(false),
443444
CreatedAt: &Timestamp{referenceTime},
445+
UpdatedAt: &Timestamp{referenceTime},
444446
ExpiresAt: &Timestamp{referenceTime},
447+
WorkflowRun: &ArtifactWorkflowRun{
448+
ID: Int64(1),
449+
RepositoryID: Int64(1),
450+
HeadRepositoryID: Int64(1),
451+
HeadBranch: String("b"),
452+
HeadSHA: String("s"),
453+
},
445454
}
446455

447456
want := `{
448457
"id": 1,
449458
"node_id": "nid",
450459
"name": "n",
451460
"size_in_bytes": 1,
461+
"url": "u",
452462
"archive_download_url": "a",
453463
"expired": false,
454464
"created_at": ` + referenceTimeStr + `,
455-
"expires_at": ` + referenceTimeStr + `
465+
"updated_at": ` + referenceTimeStr + `,
466+
"expires_at": ` + referenceTimeStr + `,
467+
"workflow_run": {
468+
"id": 1,
469+
"repository_id": 1,
470+
"head_repository_id": 1,
471+
"head_branch": "b",
472+
"head_sha": "s"
473+
}
456474
}`
457475

458476
testJSONMarshal(t, u, want)
@@ -469,10 +487,19 @@ func TestArtifactList_Marshal(t *testing.T) {
469487
NodeID: String("nid"),
470488
Name: String("n"),
471489
SizeInBytes: Int64(1),
490+
URL: String("u"),
472491
ArchiveDownloadURL: String("a"),
473492
Expired: Bool(false),
474493
CreatedAt: &Timestamp{referenceTime},
494+
UpdatedAt: &Timestamp{referenceTime},
475495
ExpiresAt: &Timestamp{referenceTime},
496+
WorkflowRun: &ArtifactWorkflowRun{
497+
ID: Int64(1),
498+
RepositoryID: Int64(1),
499+
HeadRepositoryID: Int64(1),
500+
HeadBranch: String("b"),
501+
HeadSHA: String("s"),
502+
},
476503
},
477504
},
478505
}
@@ -484,10 +511,19 @@ func TestArtifactList_Marshal(t *testing.T) {
484511
"node_id": "nid",
485512
"name": "n",
486513
"size_in_bytes": 1,
514+
"url": "u",
487515
"archive_download_url": "a",
488516
"expired": false,
489517
"created_at": ` + referenceTimeStr + `,
490-
"expires_at": ` + referenceTimeStr + `
518+
"updated_at": ` + referenceTimeStr + `,
519+
"expires_at": ` + referenceTimeStr + `,
520+
"workflow_run": {
521+
"id": 1,
522+
"repository_id": 1,
523+
"head_repository_id": 1,
524+
"head_branch": "b",
525+
"head_sha": "s"
526+
}
491527
}]
492528
}`
493529

github/apps_marketplace.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ type MarketplacePlan struct {
4646

4747
// MarketplacePurchase represents a GitHub Apps Marketplace Purchase.
4848
type MarketplacePurchase struct {
49+
Account *MarketplacePurchaseAccount `json:"account,omitempty"`
4950
// BillingCycle can be one of the values "yearly", "monthly" or nil.
5051
BillingCycle *string `json:"billing_cycle,omitempty"`
5152
NextBillingDate *Timestamp `json:"next_billing_date,omitempty"`
@@ -75,6 +76,17 @@ type MarketplacePlanAccount struct {
7576
MarketplacePendingChange *MarketplacePendingChange `json:"marketplace_pending_change,omitempty"`
7677
}
7778

79+
// MarketplacePurchaseAccount represents a GitHub Account (user or organization) for a Purchase.
80+
type MarketplacePurchaseAccount struct {
81+
URL *string `json:"url,omitempty"`
82+
Type *string `json:"type,omitempty"`
83+
ID *int64 `json:"id,omitempty"`
84+
Login *string `json:"login,omitempty"`
85+
OrganizationBillingEmail *string `json:"organization_billing_email,omitempty"`
86+
Email *string `json:"email,omitempty"`
87+
NodeID *string `json:"node_id,omitempty"`
88+
}
89+
7890
// ListPlans lists all plans for your Marketplace listing.
7991
//
8092
// GitHub API docs: https://docs.github.com/en/rest/apps#list-plans

github/github-accessors.go

Lines changed: 128 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)