GCSS-49: Fix compare action so import PRs only contain real changes#51
Merged
Merged
Conversation
1. Improve file comparison logic in `compare/action.yaml` to handle unchanged files more precisely. 2. Add conditional check in `pr-bot/action.yaml` to prevent unnecessary PR creation when there are no changes.
pavlovic-ivan
approved these changes
Jun 17, 2026
pavlovic-ivan
left a comment
Contributor
There was a problem hiding this comment.
LGTM. Thanks @dev-milos 🚀
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.
What
Fixes the
comparecomposite action so it actually removes unchanged configs,and guards
pr-botso it doesn't open empty/noise PRs.Closes #49. Prerequisite for #1132 (drift check doesn't detect manually-created repos).
Why
The
compareaction captured the compare command's JSON output into$resultbut then tested
$files_to_delete, which was never assigned — so it always hitthe "No files to delete" branch and removed nothing. Every
import/bulk-importPR therefore contained every repo, defeating the purpose of the compare step.
Changes
.github/actions/compare/action.yamlidenticalarray from the compare JSON withjqand remove thosefiles from the source dir.
read -pthat would hang in CI.set -euo pipefailand quote thermpath..github/actions/pr-bot/action.yamlnow-reachable "no changes" case), preventing a failed empty commit and avoiding
noise PRs.
Behaviour change
Both
import.yamlandbulk-import.yamluse these actions. Previously a no-changerun always opened a redundant PR; now it cleanly opens nothing. A run with real
changes opens a PR containing only the new/changed configs.
Testing
Verified end-to-end in CI against a Milos test org (
milos-org):Note: for bulk-import to detect manually-created repos, the managing GitHub App
needs org-wide ("All repositories") access - otherwise new repos aren't visible
to the importer.