Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

make a enum gen workflow #265

Merged
merged 2 commits into from
Oct 3, 2023
Merged

make a enum gen workflow #265

merged 2 commits into from
Oct 3, 2023

Conversation

rocktavious
Copy link
Collaborator

Changelog

  • Create a new workflow that helps people regenerate enum.go

Tophatting

Have not tested this yet

@rocktavious rocktavious self-assigned this Oct 3, 2023
@rocktavious rocktavious requested review from davidbloss and a user October 3, 2023 19:48
@codecov
Copy link

codecov bot commented Oct 3, 2023

Codecov Report

Merging #265 (3cd168e) into main (c5cf856) will decrease coverage by 0.32%.
Report is 7 commits behind head on main.
The diff coverage is 60.00%.

@@            Coverage Diff             @@
##             main     #265      +/-   ##
==========================================
- Coverage   77.77%   77.45%   -0.32%     
==========================================
  Files          50       50              
  Lines        3275     3335      +60     
==========================================
+ Hits         2547     2583      +36     
- Misses        531      549      +18     
- Partials      197      203       +6     
Files Coverage Δ
check_has_owner.go 100.00% <ø> (ø)
clientGQL.go 68.51% <ø> (ø)
tags.go 47.10% <0.00%> (-1.41%) ⬇️
infra.go 79.84% <64.28%> (-4.32%) ⬇️
user.go 79.46% <64.28%> (-5.06%) ⬇️

@@ -1,28 +1,28 @@
package opslevel

type ServiceOwnershipCheckFragment struct {
RequireContactMethod *bool `graphql:"requireContactMethod"`
ContactMethod *ServiceOwnershipCheckContactType `graphql:"contactMethod"`
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

enum.go doesn't generate this enum and it seems like contact type is the same thing so consolidating this.

"net/http"
"strings"

"github.com/hashicorp/go-retryablehttp"
"github.com/hasura/go-graphql-client"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gofumpt changes that fail go vet

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test github action related to this includes running task lint defined in the Taskfile. Specifically it runs gofumpt -d . with the -d flag printing a diff - gofumpt itself doesn't write any changes.

The failure is from go vet ./...

Error: vet: ./infra_test.go:288:3: too few values in struct literal of type struct{Request string; Variables string; Response string}

caused by some changes made in a recently merge PR

@@ -298,27 +298,6 @@ var AllContactType = []string{
string(ContactTypeGitHub),
}

// TODO: This appears to be duplicative of the above and i'm not sure why we need it
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

basically - actioning this TODO - so that we can have enum.go be auto generated at the click of the button

@@ -460,6 +439,7 @@ const (
PredicateKeyEnumTags PredicateKeyEnum = "tags" // Filter by `tags` field.
PredicateKeyEnumOwnerID PredicateKeyEnum = "owner_id" // Filter by `owner` field.
PredicateKeyEnumGroupIDs PredicateKeyEnum = "group_ids" // Filter by group hierarchy. Will return resources who's owner is in the group ancestry chain.
PredicateKeyEnumOwnerIDs PredicateKeyEnum = "owner_ids" // Filter by `owner` hierarchy. Will return resources who's owner is in the team ancestry chain.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey look a new enum value 🎉

UserRoleAdmin UserRole = "admin" // An administrator on the account.
UserRoleUser UserRole = "user" // A regular user on the account.
UserRoleAdmin UserRole = "admin" // An administrator on the account.
UserRoleBasicUser UserRole = "basic_user" // A basic user on the account with limited access.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is due to the new RBAC feature flag. I'm told that if a customer tries to use this when their feature flag is not on they will get an error message saying its not enabled on their account. So this should be safe

Copy link
Contributor

@davidbloss davidbloss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rocktavious rocktavious merged commit d85fb2a into main Oct 3, 2023
5 checks passed
@rocktavious rocktavious deleted the kr/enum-gen-workflow branch October 3, 2023 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants