Skip to content

Closes #865 - Add get_changed_items() utility for git-based selective deployment#891

Open
vipulb91 wants to merge 25 commits intomicrosoft:mainfrom
vipulb91:feature/get-changed-items
Open

Closes #865 - Add get_changed_items() utility for git-based selective deployment#891
vipulb91 wants to merge 25 commits intomicrosoft:mainfrom
vipulb91:feature/get-changed-items

Conversation

@vipulb91
Copy link
Copy Markdown

Description

Briefly describe what this PR does and why.

Adds a new public utility function get_changed_items() to support git-based selective deployment of Fabric items.

Linked Issue (REQUIRED)

#865

Motivation

Closes #865. Users running CI/CD pipelines with fetchDepth: 2 (or similar shallow clones) want to deploy only the items that changed in a given commit/ref, rather than publishing all items every time.

## Approach (Option 2 — Decoupled) - Discussed in comment section with @shirasassoon

Rather than adding changed_only / git_compare_ref parameters directly to publish_all_items() and unpublish_all_orphan_items() (Option 1), this PR exposes the git-diff logic as a standalone utility function. This keeps the core publishing functions clean and allows users to compose the deployment logic themselves.

New API

from fabric_cicd import get_changed_items

changed = get_changed_items(repository_directory, git_compare_ref="HEAD~1")
# Returns a list of item names that were added/modified/renamed

if changed:
    publish_all_items(workspace, items_to_include=changed)

@vipulb91
Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

@shirasassoon
Copy link
Copy Markdown
Contributor

@vipulb91 Thanks for submitting this PR, let's make sure the branch is updated completely. I did a quick scan and noticed some code was getting unintentionally removed. Happy to review once everything is up to date.

@vipulb91 vipulb91 force-pushed the feature/get-changed-items branch from c3cafc2 to be1c79b Compare April 1, 2026 08:58
@vipulb91
Copy link
Copy Markdown
Author

vipulb91 commented Apr 1, 2026

@shirasassoon - Thanks for the heads up! The branch was behind main by several commits, which was making the diff look like code was being removed — that was a red herring from the stale base.

I've rebased onto the latest main and force-pushed. The diff should now cleanly show only the additions:

  • New get_changed_items() function in publish.py
  • Export in init.py
  • Documentation in optional_feature.md
  • 6 new unit tests in test_publish.py
  • Changie entry

All 35 tests pass (including the new file-sorting tests added upstream). Happy to make any adjustments based on your review!

Comment thread docs/how_to/optional_feature.md Outdated
Comment thread docs/how_to/optional_feature.md
Comment thread src/fabric_cicd/publish.py Outdated
Comment thread src/fabric_cicd/publish.py Outdated
Comment thread src/fabric_cicd/publish.py Outdated
Comment thread src/fabric_cicd/publish.py Outdated
Comment thread src/fabric_cicd/publish.py Outdated
Comment thread src/fabric_cicd/publish.py Outdated
@vipulb91 vipulb91 force-pushed the feature/get-changed-items branch from 8f49510 to 27a75df Compare April 13, 2026 06:13
@vipulb91
Copy link
Copy Markdown
Author

@shirasassoon - All review comments have been addressed and the branch is up to date. Happy for another look when you get a chance!

@vipulb91 vipulb91 requested a review from shirasassoon April 13, 2026 16:57
Comment thread src/fabric_cicd/_common/_validate_input.py
Comment thread src/fabric_cicd/_common/_git_diff_utils.py
Comment thread src/fabric_cicd/_common/_git_utils.py Outdated
Comment thread docs/how_to/optional_feature.md Outdated
Comment thread src/fabric_cicd/_common/_git_diff_utils.py
Comment thread src/fabric_cicd/_items/_base_publisher.py
Comment thread src/fabric_cicd/publish.py Outdated
Comment thread tests/test_publish.py Outdated
Comment thread src/fabric_cicd/publish.py
@vipulb91
Copy link
Copy Markdown
Author

@shirasassoon - All review comments have been addressed and the branch is up to date. Happy for another look when you get a chance!

@vipulb91 vipulb91 requested a review from shirasassoon April 16, 2026 06:01
Copy link
Copy Markdown
Contributor

@shirasassoon shirasassoon left a comment

Choose a reason for hiding this comment

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

@vipulb91 Thank you for addressing all the comments! Added one small comment, outside of that I think this PR looks good to merge - thank you for the contribution!

Comment thread tests/test_git_diff_utils.py Outdated
@vipulb91 vipulb91 requested a review from shirasassoon April 16, 2026 10:18
@vipulb91
Copy link
Copy Markdown
Author

@shirasassoon - updated the assertion to verify the exact argv list. Thanks! If all okay now, we can merge the PR

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.

Add changed_only support for git-diff-based selective deployment

2 participants