Use commit message trailer to detect infinite loop#1095
Merged
Conversation
Contributor
There was a problem hiding this comment.
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.tsmodule with centralized infinite loop detection logic using commit message trailers - Updates all commit and merge operations to include the
Generated-bytrailer as an additional message paragraph - Refactors
git.commit()andgit.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.
Co-authored-by: Copilot <[email protected]>
https://github.com/int128/update-generated-files-action/actions/runs/20676710832 Generated-by: update-generated-files-action
Auto-generated-by: update-generated-files-action; https://github.com/int128/update-generated-files-action/actions/runs/20686486352
Auto-generated-by: update-generated-files-action; https://github.com/int128/update-generated-files-action/actions/runs/20687469917
Auto-generated-by: update-generated-files-action; https://github.com/int128/update-generated-files-action/actions/runs/20688276166
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prepare for #1091