Skip to content

Conversation

ritek01
Copy link
Contributor

@ritek01 ritek01 commented Aug 21, 2025

Make author/committer fields optional for GitHub App signed commits

Overview

This PR modifies the GitHub driver in go-scm to make author and committer fields optional when using GitHub App authentication for commits. This change enables automatic commit signing by GitHub Apps without requiring explicit signature information.

Problem

Ticket : https://harness.atlassian.net/browse/PIPE-29374

When using GitHub App authentication, commits can be automatically signed by GitHub without providing explicit author/committer information. However, the current implementation in go-scm always includes these fields in the request payload, which prevents GitHub from automatically signing the commits.

Solution

This PR modifies the content service in the GitHub driver to:

  1. Make author/committer fields optional in the request payload
  2. Only include these fields when signature information is explicitly provided
  3. Omit these fields when using GitHub App authentication, allowing GitHub to automatically sign the commits

Changes

  • Updated contentService.Create() to omit author/committer fields when signature is empty
  • Updated contentService.Update() to omit author/committer fields when signature is empty
  • Updated contentService.Delete() to omit author/committer fields when signature is empty
  • Added comments explaining the GitHub App signed commits behavior

Testing

  • Verified with a proof of concept that commits are properly signed when using GitHub App authentication
  • Confirmed backward compatibility with existing code that provides explicit signature information
  • Tested with real GitHub App credentials to ensure commits show as "Verified" in GitHub UI

Screenshot

image image
Screen.Recording.2025-08-21.at.7.09.10.PM.mov

@CLAassistant
Copy link

CLAassistant commented Aug 21, 2025

CLA assistant check
All committers have signed the CLA.

@ritek01 ritek01 requested a review from Copilot August 21, 2025 16:50
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enables automatic commit signing for GitHub Apps by making author and committer fields optional in the GitHub driver's content service. This allows GitHub to automatically sign commits when using GitHub App authentication instead of requiring explicit signature information.

Key changes:

  • Modified content service methods (Create, Update, Delete) to conditionally include author/committer fields
  • Added logic to omit author/committer when signature name/email are empty
  • Updated struct field types to use pointers with omitempty JSON tags

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@mohitg0795 mohitg0795 merged commit c0ad4e7 into master Aug 21, 2025
2 checks passed
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.

4 participants