Skip to content

feat!: Replace actions env secret endpoints#4335

Open
stevehipwell wants to merge 2 commits into
google:masterfrom
stevehipwell:actions-repo-env-secrets
Open

feat!: Replace actions env secret endpoints#4335
stevehipwell wants to merge 2 commits into
google:masterfrom
stevehipwell:actions-repo-env-secrets

Conversation

@stevehipwell

Copy link
Copy Markdown
Contributor

This PR updates the actions environment secrets functions to use the documented and supported endpoints, it also changes all actions secret create/update functions to use a value parameter (#3644).

Signed-off-by: Steve Hipwell <steve.hipwell@gmail.com>
@gmlewis gmlewis added NeedsReview PR is awaiting a review before merging. Breaking API Change PR will require a bump to the major version num in next release. Look here to see the change(s). labels Jun 26, 2026
}

func encryptSecretWithPublicKey(publicKey *github.PublicKey, secretName, secretValue string) (*github.EncryptedSecret, error) {
func encryptSecretWithPublicKey(publicKey *github.PublicKey, secretName, secretValue string) (github.EncryptedSecret, error) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

What value is there to changing the return type from a pointer to a value?
It is pretty standard practice in Go to return nil when there is an error.
Why would we change that for this method?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure it makes any difference in this code if we're returning nil or an empty struct, AFAIK both could be considered idiomatic Go. I did this just before logging off for the weekend so I'm on my phone and can't see if this is a linter error? If it is I'll fix it. FYI I don't this example is particularly idiomatic Go given the unnecessary function separation.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Yeah, there are linter and test errors in this PR.

During code reviews at Google, I was told to not return a value struct during an error because a nil value was perfectly valid. So from my experience with the Go team, it is more idiomatic to return a nil pointer to a struct than to return an empty value struct when errors are possible.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I'll fix it up when I get a few mins. I'll probably just get rid of the function call as that'd remove the whole issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Breaking API Change PR will require a bump to the major version num in next release. Look here to see the change(s). NeedsReview PR is awaiting a review before merging.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants