Skip to content

refactor: migrate resource_github_actions_environment_variable to tflog#3325

Open
texasich wants to merge 2 commits intointegrations:mainfrom
texasich:refactor/tflog-actions-env-variable
Open

refactor: migrate resource_github_actions_environment_variable to tflog#3325
texasich wants to merge 2 commits intointegrations:mainfrom
texasich:refactor/tflog-actions-env-variable

Conversation

@texasich
Copy link
Copy Markdown

@texasich texasich commented Apr 9, 2026

Replace Go standard log package with HashiCorp structured tflog for consistent logging across the provider.

Changes:


Before the change?

resource_github_actions_environment_variable.go uses Go's standard log.Printf for logging, which produces unstructured output inconsistent with the rest of the provider.

After the change?

Logging uses HashiCorp's tflog.Info with structured key-value fields (variable_id), consistent with the pattern established in other migrated files like resource_github_membership.go.

Pull request checklist

  • Schema migrations have been created if needed
  • - [x] Acceptance tests have been run (no behavioral changes — logging only)
  • - [x] Documentation has been updated if needed (N/A — internal refactor)

Replace Go standard `log` package with HashiCorp structured `tflog` for consistent logging across the provider.

Changes:
- Replace `log` import with `fmt` and add `tflog` import
- Convert `log.Printf` to `tflog.Info` with structured fields

Part of integrations#3070
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 9, 2026

👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labeled with Status: Up for grabs. You & others like you are the reason all of this works! So thank you & happy coding! 🚀

if errors.As(err, &ghErr) {
if ghErr.Response.StatusCode == http.StatusNotFound {
log.Printf("[INFO] Removing actions variable %s from state because it no longer exists in GitHub", d.Id())
tflog.Info(ctx, fmt.Sprintf("Removing actions variable %s from state because it no longer exists in GitHub", d.Id()), map[string]any{
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.

Please don't use fmt.Sprintf inside tflog calls

Address review feedback: use static log message string instead of
fmt.Sprintf inside tflog.Info. Remove now-unused "fmt" import.
@texasich
Copy link
Copy Markdown
Author

texasich commented Apr 9, 2026

Good catch, thanks @deiga! Fixed in 7a882e5 — now using a static message string with the variable ID passed only through the structured fields map. Also removed the now-unused fmt import.

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.

[MAINT] Tracking issue for refactoring logging to use tflog instead of log

2 participants