Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add path filtering support for monorepo setups#1458

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
mikepenz merged 16 commits intodevelopfromcopilot/fix-1457
Aug 17, 2025

Conversation

Copy link
Contributor

CopilotAI commentedJul 4, 2025
edited
Loading

This PR adds the ability to filter commits by file paths, enabling better changelog generation for monorepo setups where different applications are stored in separate directories.

Problem

In monorepo environments, users often want to generate changelogs that only include commits affecting specific parts of the codebase. For example, when deployingapp2, they don't want to see commits that only touched files inapp1/. The GitHub API's compare endpoint doesn't support path filtering likegit log -- app1/ does.

Solution

Added a new optional input parameterincludeOnlyPaths that accepts comma-separated path patterns:

-name:"App1 Changelog"uses:mikepenz/release-changelog-builder-action@{latest-release}with:includeOnlyPaths:"app1/,shared/"fromTag:"v1.0.0"toTag:"v2.0.0"

Implementation Details

  • GitHub API approach: For each commit, fetches file changes via additional API calls and filters commits based on whether any changed file matches the specified path patterns
  • Gitea approach: Usesgit log -- <paths> to filter commits directly by path using local git commands
  • Path matching: UsesstartsWith() for flexible prefix matching (e.g.,app1/ matchesapp1/src/file.js)
  • Backward compatible: Optional parameter that doesn't affect existing functionality

Changes Made

  • AddedincludeOnlyPaths input parameter toaction.yml
  • Updated input processing inmain.ts and parameter passing through the call chain
  • ExtendedOptions interface and repository classes to support path filtering
  • Added path filtering logic to bothGithubRepository andGiteaRepository
  • Added comprehensive tests for the new functionality
  • Updated README with usage examples and documentation

Testing

Added unit tests covering:

  • Path pattern parsing (comma-separated, whitespace handling)
  • Integration with existing commit filtering
  • Edge cases (empty paths, malformed input)

Existing tests continue to pass, ensuring backward compatibility.

Fixes#1457.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • gitea.com
    • Triggering command:/usr/local/bin/node /home/REDACTED/work/release-changelog-builder-action/release-changelog-builder-action/node_modules/jest-worker/build/workers/processChild.js (dns block)
  • https://api.github.com/graphql
    • Triggering command:/usr/local/bin/node /home/REDACTED/work/release-changelog-builder-action/release-changelog-builder-action/node_modules/jest-worker/build/workers/processChild.js (http block)
  • https://api.github.com/repos/mikepenz/release-changelog-builder-action-playground/compare/1.5.0...2.0.0
    • Triggering command:/usr/local/bin/node /home/REDACTED/work/release-changelog-builder-action/release-changelog-builder-action/node_modules/jest-worker/build/workers/processChild.js (http block)
  • https://api.github.com/repos/mikepenz/release-changelog-builder-action-playground/compare/2.0.0...3.0.0-a01
    • Triggering command:/usr/local/bin/node /home/REDACTED/work/release-changelog-builder-action/release-changelog-builder-action/node_modules/jest-worker/build/workers/processChild.js (http block)
  • https://api.github.com/repos/mikepenz/release-changelog-builder-action-playground/compare/2.0.0...3.0.1
    • Triggering command:/usr/local/bin/node /home/REDACTED/work/release-changelog-builder-action/release-changelog-builder-action/node_modules/jest-worker/build/workers/processChild.js (http block)
  • https://api.github.com/repos/mikepenz/release-changelog-builder-action-playground/releases/tags/1.5.0
    • Triggering command:/usr/local/bin/node /home/REDACTED/work/release-changelog-builder-action/release-changelog-builder-action/node_modules/jest-worker/build/workers/processChild.js (http block)
  • https://api.github.com/repos/mikepenz/release-changelog-builder-action-playground/releases/tags/2.0.0
    • Triggering command:/usr/local/bin/node /home/REDACTED/work/release-changelog-builder-action/release-changelog-builder-action/node_modules/jest-worker/build/workers/processChild.js (http block)
  • https://api.github.com/repos/mikepenz/release-changelog-builder-action-playground/releases/tags/3.0.0-a01
    • Triggering command:/usr/local/bin/node /home/REDACTED/work/release-changelog-builder-action/release-changelog-builder-action/node_modules/jest-worker/build/workers/processChild.js (http block)
  • https://api.github.com/repos/mikepenz/release-changelog-builder-action-playground/releases/tags/3.0.1
    • Triggering command:/usr/local/bin/node /home/REDACTED/work/release-changelog-builder-action/release-changelog-builder-action/node_modules/jest-worker/build/workers/processChild.js (http block)

If you need me to access, download, or install something from one of these locations, you can either:


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Clickhere to start the survey.

CopilotAI changed the title[WIP] Filtering commits by pathAdd path filtering support for monorepo setupsJul 4, 2025
CopilotAI requested a review frommikepenzJuly 4, 2025 11:37
Copilot finished work on behalf ofmikepenzJuly 4, 2025 11:37
@caspervdw
Copy link

@mikepenz I tested this branch and it works as I would expect it to (using Github backend)

mikepenz reacted with hooray emoji

@mikepenz
Copy link
Owner

@copilot rebase please

Copy link
ContributorAuthor

@copilot rebase please

I'm unable to perform git rebase operations as I don't have access to git push/rebase commands in this environment. You'll need to rebase this branch manually or through the GitHub interface.

Copilot finished work on behalf ofmikepenzAugust 12, 2025 05:17
@github-actions
Copy link

github-actionsbot commentedAug 12, 2025
edited
Loading

TestsPassed ✅SkippedFailed
JUnit Test Report67 ran67 passed0 skipped0 failed
TestResult
No test annotations available

This comment was marked as outdated.

@mikepenzmikepenz marked this pull request as ready for reviewAugust 16, 2025 10:05
CopilotAIand others added10 commitsAugust 16, 2025 14:13
Co-authored-by: mikepenz <1476232+mikepenz@users.noreply.github.com>
…ementations- Refactored `includeOnlyPaths` handling for better consistency.- Added path filtering to `getDiffStats` and `getCommitsBetween` functions.- Updated tests to reflect changes in path filtering logic.- Enhanced offline and remote repository handling with path filtering support.
…sitory- Refactored path filtering logic for better efficiency and readability.- Consolidated file matching and commit filtering to reduce redundant API calls.- Improved handling of commit-to-file mapping.- Adjusted logic to streamline stats collection and filtering process.

This comment was marked as outdated.

@mikepenzmikepenz requested a review fromCopilotAugust 17, 2025 10:39
Copy link

CopilotAI 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 adds support for path filtering in monorepo environments by introducing anincludeOnlyPaths parameter that allows filtering commits based on the files they modify. This enables users to generate changelogs that only include commits affecting specific parts of their codebase.

  • AddedincludeOnlyPaths input parameter to filter commits by file paths
  • Updated repository implementations to support path filtering with different strategies for GitHub and Gitea
  • Added comprehensive test coverage for the new functionality

Reviewed Changes

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

Show a summary per file
FileDescription
action.ymlAddedincludeOnlyPaths input parameter definition
src/main.tsAdded input processing for path patterns with filtering logic
src/repositories/*.tsUpdated all repository classes to support path filtering parameter
src/pr-collector/*.tsUpdated data flow to pass path filtering through the collection pipeline
tests/pathFiltering.test.tsAdded unit tests for path filtering functionality
README.mdAdded documentation and usage examples for monorepo configuration

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

authorName:commit.authorName,
authorDate:moment(commit.authorDate),
committer:"",
committerName:"",

Choose a reason for hiding this comment

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

The committer field is hardcoded to an empty string instead of using the actual commit data. This loses information that was previously available in the original implementation.

Suggested change
committerName:"",
committer:commit.committer??"",
committerName:commit.committerName??"",

Copilot uses AI. Check for mistakes.
authorName:commit.authorName,
authorDate:moment(commit.authorDate),
committer:"",
committerName:"",

Choose a reason for hiding this comment

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

The committerName field is hardcoded to an empty string instead of using the actual commit data. This loses information that was previously available in the original implementation.

Suggested change
committerName:"",
committer:commit.committer,
committerName:commit.committerName,

Copilot uses AI. Check for mistakes.
letchangeCount=0
letcommitCount=0

constpathFilteringEnabled=(includeOnlyPaths&&includeOnlyPaths.length>0)==true

Choose a reason for hiding this comment

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

Using== true is redundant. The expression(includeOnlyPaths && includeOnlyPaths.length > 0) already returns a boolean.

Suggested change
constpathFilteringEnabled=(includeOnlyPaths&&includeOnlyPaths.length>0)==true
constpathFilteringEnabled=(includeOnlyPaths&&includeOnlyPaths.length>0)

Copilot uses AI. Check for mistakes.
commitInfo:commits
commits:filteredCommits.length,
commitInfo:filteredCommits
.filter(commit=>commit.sha)

Choose a reason for hiding this comment

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

[nitpick] The filter operationcommit => commit.sha is applied after path filtering, butcommit.sha should always be present in GitHub API responses. This filter may be unnecessary or could indicate a deeper issue.

Suggested change
.filter(commit => commit.sha)

Copilot uses AI. Check for mistakes.
@mikepenzmikepenz merged commit3429301 intodevelopAug 17, 2025
7 checks passed
@mikepenzmikepenz deleted the copilot/fix-1457 branchAugust 17, 2025 11:09
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

Copilot code reviewCopilotCopilot left review comments

@mikepenzmikepenzAwaiting requested review from mikepenz

Labels

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Filtering commits by path

3 participants

@caspervdw@mikepenz

[8]ページ先頭

©2009-2025 Movatter.jp