Skip to content

feat!: Refactor actions variables to pass request by value#4346

Open
stevehipwell wants to merge 6 commits into
google:masterfrom
stevehipwell:actions-variables-request-by-value
Open

feat!: Refactor actions variables to pass request by value#4346
stevehipwell wants to merge 6 commits into
google:masterfrom
stevehipwell:actions-variables-request-by-value

Conversation

@stevehipwell

@stevehipwell stevehipwell commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

BREAKING CHANGE: ActionsService methods involving variables have new params and return values.

This PR updates the actions variable create & update functions to use a value parameter (see #3644). This aligns actions variables with the changes made to actions secrets in #4335.

Signed-off-by: Steve Hipwell <steve.hipwell@gmail.com>
@gmlewis gmlewis changed the title feat: Refactor actions variables to pass request by value feat!: Refactor actions variables to pass request by value Jul 1, 2026
@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 Jul 1, 2026
@codecov

codecov Bot commented Jul 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.51%. Comparing base (f55b336) to head (8c9498a).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4346   +/-   ##
=======================================
  Coverage   97.50%   97.51%           
=======================================
  Files         193      193           
  Lines       19481    19519   +38     
=======================================
+ Hits        18995    19033   +38     
  Misses        269      269           
  Partials      217      217           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gmlewis gmlewis left a comment

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.

Thank you, @stevehipwell!
LGTM.
Awaiting second LGTM+Approval from any other contributor to this repo before merging.

cc: @alexandear - @Not-Dhananjay-Mishra

Comment thread github/actions_variables.go Outdated
func (s *ActionsService) UpdateOrgVariable(ctx context.Context, org string, variable *ActionsVariable) (*Response, error) {
if variable == nil {
return nil, errors.New("variable must be provided")
func (s *ActionsService) UpdateOrgVariable(ctx context.Context, org, name string, body OrgActionsVariableRequest) (*Response, error) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We can't reuse OrgActionsVariableRequest because all fields are optional, according to the schema:

Image

We need a separate struct.

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.

Good spot, I'll change this.

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.

@alexandear this should be fixed now.

Comment thread github/actions_variables.go Outdated
url := fmt.Sprintf("repos/%v/%v/environments/%v/variables/%v", owner, repo, env, variable.Name)
return s.patchVariable(ctx, url, variable)
}
func (s *ActionsService) UpdateEnvVariable(ctx context.Context, owner, repo, env, name string, body ActionsVariableRequest) (*Response, error) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We can't share the same ActionsVariableRequest for create and update. Should be a struct with optional fields.

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.

@alexandear this should be fixed now.

@stevehipwell stevehipwell requested a review from alexandear July 2, 2026 08:34
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.

3 participants