Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat: Add CreatedAt and UpdatedAt to Ruleset #3316

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions github/repos_rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,8 @@ type Ruleset struct {
Links *RulesetLinks `json:"_links,omitempty"`
Conditions *RulesetConditions `json:"conditions,omitempty"`
Rules []*RepositoryRule `json:"rules,omitempty"`
UpdatedAt *Timestamp `json:"updated_at,omitempty"`
CreatedAt *Timestamp `json:"created_at,omitempty"`
}

// rulesetNoOmitBypassActors represents a GitHub ruleset object. The struct does not omit bypassActors if the field is nil or an empty array is passed.
Expand Down
18 changes: 15 additions & 3 deletions github/repos_rules_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -489,14 +489,18 @@ func TestRepositoriesService_GetAllRulesets(t *testing.T) {
"name": "ruleset",
"source_type": "Repository",
"source": "o/repo",
"enforcement": "enabled"
"enforcement": "enabled",
"created_at": `+referenceTimeStr+`,
"updated_at": `+referenceTimeStr+`
},
{
"id": 314,
"name": "Another ruleset",
"source_type": "Repository",
"source": "o/repo",
"enforcement": "enabled"
"enforcement": "enabled",
"created_at": `+referenceTimeStr+`,
"updated_at": `+referenceTimeStr+`
}
]`)
})
Expand All @@ -514,13 +518,17 @@ func TestRepositoriesService_GetAllRulesets(t *testing.T) {
SourceType: String("Repository"),
Source: "o/repo",
Enforcement: "enabled",
CreatedAt: &Timestamp{referenceTime},
UpdatedAt: &Timestamp{referenceTime},
},
{
ID: Int64(314),
Name: "Another ruleset",
SourceType: String("Repository"),
Source: "o/repo",
Enforcement: "enabled",
CreatedAt: &Timestamp{referenceTime},
UpdatedAt: &Timestamp{referenceTime},
},
}
if !cmp.Equal(ruleSet, want) {
Expand Down Expand Up @@ -683,7 +691,9 @@ func TestRepositoriesService_GetRuleset(t *testing.T) {
"name": "ruleset",
"source_type": "Organization",
"source": "o",
"enforcement": "enabled"
"enforcement": "enabled",
"created_at": `+referenceTimeStr+`,
"updated_at": `+referenceTimeStr+`
}`)
})

Expand All @@ -699,6 +709,8 @@ func TestRepositoriesService_GetRuleset(t *testing.T) {
SourceType: String("Organization"),
Source: "o",
Enforcement: "enabled",
CreatedAt: &Timestamp{referenceTime},
UpdatedAt: &Timestamp{referenceTime},
}
if !cmp.Equal(ruleSet, want) {
t.Errorf("Repositories.GetRuleset returned %+v, want %+v", ruleSet, want)
Expand Down
Loading