Skip to content

Use commit message trailer to detect infinite loop#1095

Merged
int128 merged 24 commits intomainfrom
int128/Use-commit-message-trailer-to-detect-infinite-loop
Jan 4, 2026
Merged

Use commit message trailer to detect infinite loop#1095
int128 merged 24 commits intomainfrom
int128/Use-commit-message-trailer-to-detect-infinite-loop

Conversation

@int128
Copy link
Copy Markdown
Owner

@int128 int128 commented Jan 3, 2026

Prepare for #1091

@int128 int128 marked this pull request as ready for review January 3, 2026 07:55
@int128 int128 requested a review from Copilot January 3, 2026 07:55
Copy link
Copy Markdown
Contributor

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 refactors the infinite loop detection mechanism from checking commit author names to using Git commit message trailers. The new approach adds a Generated-by: update-generated-files-action trailer to all commits and merges created by this action, then checks for this trailer in the last 5 commits to detect potential infinite loops.

Key Changes

  • Introduces a new commit.ts module with centralized infinite loop detection logic using commit message trailers
  • Updates all commit and merge operations to include the Generated-by trailer as an additional message paragraph
  • Refactors git.commit() and git.merge() function signatures to accept arrays of messages instead of a single message with optional additional messages

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/commit.ts New module containing infinite loop detection logic and the GENERATED_BY_TRAILER constant
src/git.ts Replaced getAuthorNameOfCommits with getCommitMessages, refactored commit and merge functions to accept message arrays
src/pull_request_event.ts Integrated new infinite loop detection, removed duplicate logic, added trailer to all commits and merges
src/other_event.ts Integrated new infinite loop detection, removed duplicate logic, added trailer to commits
src/run.ts Removed blank lines (whitespace cleanup)
tests/commit.test.ts New test file for infinite loop detection functionality
tests/pull_request_event.test.ts Updated mocks from getAuthorNameOfCommits to getCommitMessages, removed test for old infinite loop detection, updated expectations for new commit/merge signatures
tests/other_event.test.ts Updated mocks and expectations to match new function signatures

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/commit.test.ts Outdated
Comment thread src/commit.ts Outdated
Comment thread tests/commit.test.ts Outdated
Comment thread src/commit.ts Outdated
@int128 int128 merged commit b4d12af into main Jan 4, 2026
3 checks passed
@int128 int128 deleted the int128/Use-commit-message-trailer-to-detect-infinite-loop branch January 4, 2026 05:39
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