Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 7, 2025

Problem

The main agentic job was missing git configuration, which could cause issues when AI agents attempt to perform git operations during workflow execution. The helper function generateGitConfigurationSteps() existed and was being used in safe-output jobs (create_pull_request, push_to_pull_request_branch, publish_assets), but was not being called in the main job.

Solution

Added a call to generateGitConfigurationSteps() in the generateMainJobSteps() function in pkg/workflow/compiler.go. The git configuration step is now positioned after cache setup and before engine installation, ensuring the git user is properly configured before any agentic workflow execution.

Changes

  • Modified pkg/workflow/compiler.go: Added git configuration step in main job generation
  • Added pkg/workflow/git_config_test.go: Test coverage to verify git config appears in compiled workflows
  • Recompiled all workflows: All 59 workflow files now include git configuration in the main job

Git Configuration Details

The step configures:

  • user.email: github-actions[bot]@users.noreply.github.com
  • user.name: ${{ github.workflow }}

Example

Before this change, a workflow would look like:

  agent:
    steps:
      - name: Checkout repository
        uses: actions/checkout@v5
      - name: Setup Node.js  # Missing git config!
        uses: actions/setup-node@v4

After this change:

  agent:
    steps:
      - name: Checkout repository
        uses: actions/checkout@v5
      - name: Configure Git credentials  # ✅ Git config added
        run: |
          git config --global user.email "github-actions[bot]@users.noreply.github.com"
          git config --global user.name "${{ github.workflow }}"
          echo "Git configured with standard GitHub Actions identity"
      - name: Setup Node.js
        uses: actions/setup-node@v4

Testing

  • ✅ All existing tests pass (unit + integration)
  • ✅ New tests verify git config appears in compiled workflows
  • ✅ Linting and formatting pass
  • make agent-finish completes successfully
Original prompt

Add a step in the agentic job to configure the git user as githubaction (there is a helper to do this in compiler already).


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits October 7, 2025 17:45
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
- Call generateGitConfigurationSteps() in generateMainJobSteps()
- Position after cache setup and before engine installation
- Add test to verify git config appears in compiled workflows
- All existing tests pass, linting passes
- Recompiled all workflows successfully

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add step to configure git user for GitHub Action Add git configuration step to main agentic job Oct 7, 2025
Copilot AI requested a review from pelikhan October 7, 2025 17:56
@pelikhan pelikhan marked this pull request as ready for review October 7, 2025 18:07
@pelikhan pelikhan merged commit e2d95b2 into main Oct 7, 2025
6 checks passed
@pelikhan pelikhan deleted the copilot/add-git-user-configuration branch October 7, 2025 18:14
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