Skip to content

Move generateGitConfigurationSteps from git.go to yaml_generation.go - #2286

Merged
pelikhan merged 4 commits into
mainfrom
copilot/move-generate-git-configuration-steps
Oct 24, 2025
Merged

pelikhan merged 4 commits into
mainfrom
copilot/move-generate-git-configuration-steps

Conversation

Copilot AI commented Oct 24, 2025 •

Copy link
Copy Markdown
Contributor

Overview

This PR addresses issue #2273 by moving the generateGitConfigurationSteps() function from pkg/workflow/git.go to the newly created pkg/workflow/yaml_generation.go file. This change improves code organization by ensuring generation logic is properly separated from utility functions.

Problem

The generateGitConfigurationSteps() function was misplaced in git.go, which should contain git utility logic, not YAML generation logic. This is an example of an "outlier function" that was in the wrong file, making the codebase harder to maintain and understand.

Solution

  • Created pkg/workflow/yaml_generation.go to house YAML generation functions
  • Moved generateGitConfigurationSteps() from git.go to yaml_generation.go
  • Deleted git.go as it became empty after the move (it contained no utility functions)

Changes

Created:

  • pkg/workflow/yaml_generation.go - New file containing the YAML generation function

Deleted:

  • pkg/workflow/git.go - Removed as it became empty after moving the function

Function Details

The generateGitConfigurationSteps() function generates standardized git credential setup steps for GitHub Actions workflows. It's called by:

  • compiler.go - Main workflow compilation
  • publish_assets.go - Asset publishing workflows
  • create_pull_request.go - PR creation workflows
  • push_to_pull_request_branch.go - PR branch push workflows

Testing

All existing tests continue to pass:

  • ✅ TestGitConfigurationInMainJob - Verifies git config is included in compiled workflows
  • ✅ TestGitConfigurationStepsHelper - Tests the function directly
  • ✅ All other unit tests pass (make test-unit)
  • ✅ Project builds successfully (make build)

Related Issues

Closes #2273 (part of the larger code organization effort)

Original prompt

This section details on the original issue you should resolve

<issue_title>[task] Move generateGitConfigurationSteps from git.go to yaml_generation.go</issue_title>
<issue_description>## Objective
Move the misplaced generateGitConfigurationSteps() function from pkg/workflow/git.go (utility file) to the appropriate generation file pkg/workflow/yaml_generation.go.

Context

Part of issue #2273. The function generateGitConfigurationSteps() is a YAML generation function but is currently in git.go, which should contain git utility logic, not generation logic. This is an example of an "outlier function" in the wrong file.

Note: This task depends on the completion of the "Extract generation functions from compiler.go to yaml_generation.go" task, which creates the yaml_generation.go file.

Function to Move

From pkg/workflow/git.go:

func (c *Compiler) generateGitConfigurationSteps() []string

Approach

  1. Ensure yaml_generation.go exists (from prerequisite task)
  2. Move generateGitConfigurationSteps from git.go to yaml_generation.go
  3. Update any imports if needed
  4. Verify git.go only contains utility functions (no generation logic)

Files to Modify

  • Update: pkg/workflow/yaml_generation.go (add generateGitConfigurationSteps)
  • Update: pkg/workflow/git.go (remove generateGitConfigurationSteps)

Acceptance Criteria

AI generated by Plan Command for #2273</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #2279


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits October 24, 2025 11:58
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Move generateGitConfigurationSteps function to yaml_generation.go Move generateGitConfigurationSteps from git.go to yaml_generation.go Oct 24, 2025
Copilot AI requested a review from pelikhan October 24, 2025 12:04
@pelikhan
pelikhan marked this pull request as ready for review October 24, 2025 12:04
@github-actions

Copy link
Copy Markdown
Contributor

Agentic Changeset Generator triggered by this pull request.

This changeset documents the internal code organization improvement
where generateGitConfigurationSteps was moved from git.go to
yaml_generation.go for better separation of concerns.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@pelikhan
pelikhan merged commit a521596 into main Oct 24, 2025
4 checks passed
@pelikhan
pelikhan deleted the copilot/move-generate-git-configuration-steps branch October 24, 2025 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants