Skip to content

Commit 2434ece

Browse files
fix: only flag README check on truly new integrations (#30)
Co-authored-by: Shubhank <72601061+Sagsgit@users.noreply.github.com>
1 parent 3c40738 commit 2434ece

2 files changed

Lines changed: 9 additions & 7 deletions

File tree

scripts/check_readme.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ def check_readme(base_ref: str, dirs: list[str]) -> int:
6565
return 2
6666
new_files = [f for f in added_diff.stdout.splitlines() if f.startswith(f"{d}/")]
6767

68-
if new_files and not readme_changed:
68+
is_new_integration = any(f == f"{d}/config.json" for f in new_files)
69+
if is_new_integration and not readme_changed:
6970
print(f"❌ NEW INTEGRATION DETECTED: '{d}'")
7071
print()
7172
print(" But main README.md was NOT updated!")

scripts/docs/check_readme.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Verifies that the main `README.md` is updated when new integrations are added.
44

55
## Overview
66

7-
When a new integration is added to the repository, the main `README.md` must also be updated to include the new integration in the integrations table. This script detects whether new files have been added within an integration directory and checks whether `README.md` was also modified in the same changeset.
7+
When a new integration is added to the repository, the main `README.md` must also be updated to include the new integration in the integrations table. This script detects whether a new `config.json` has been added within an integration directory (indicating a brand-new integration) and checks whether `README.md` was also modified in the same changeset.
88

99
This check only makes sense in the context of a pull request, where there is a clear base ref to compare against.
1010

@@ -50,7 +50,7 @@ flowchart TD
5050
B --> C{Directory exists?}
5151
C -->|No| B
5252
C -->|Yes| D[git diff --diff-filter=A: find newly added files in dir]
53-
D --> E{New files found?}
53+
D --> E{config.json added?}
5454
E -->|No| B
5555
E -->|Yes| F{README.md changed?}
5656
F -->|Yes| B
@@ -67,7 +67,7 @@ flowchart TD
6767
2. For each given integration directory:
6868
a. Skip if the directory doesn't exist
6969
b. Check if any files were **newly added** (`--diff-filter=A`) within that directory
70-
c. If new files exist **and** `README.md` was **not** changed → report an error
70+
c. If `config.json` was newly added (i.e. it's a brand-new integration) **and** `README.md` was **not** changed → report an error
7171
3. Exit with code 1 if any errors were found, 0 otherwise
7272

7373
### Key Git Commands
@@ -77,7 +77,7 @@ flowchart TD
7777
| `git diff --name-only <base> HEAD \| grep "^README\.md$"` | Check if root README.md was modified |
7878
| `git diff --name-only --diff-filter=A <base> HEAD \| grep "^<dir>/"` | Find newly added files in a specific directory |
7979

80-
The `--diff-filter=A` flag is important: it only shows **A**dded files, not modified ones. This means the check only triggers for _new_ integrations, not updates to existing ones.
80+
The `--diff-filter=A` flag is important: it only shows **A**dded files, not modified ones. Within those added files, the script specifically looks for `config.json` — its presence signals a brand-new integration. This means adding new files to an existing integration (e.g. unit test files) does not trigger the check.
8181

8282
## Output Format
8383

@@ -110,8 +110,9 @@ The `--diff-filter=A` flag is important: it only shows **A**dded files, not modi
110110
| Scenario | Behavior |
111111
|----------|----------|
112112
| Only existing files modified in integration dir | ✅ Passes (no new files detected) |
113-
| New files added and README.md updated | ✅ Passes |
114-
| New files added but README.md NOT updated | ❌ Fails |
113+
| New files added to existing integration (e.g. test files) | ✅ Passes (no `config.json` added) |
114+
| New integration added and README.md updated | ✅ Passes |
115+
| New integration added but README.md NOT updated | ❌ Fails |
115116
| Directory argument doesn't exist on disk | Skipped silently |
116117
| No arguments provided | Exits with code 2 (usage error) |
117118

0 commit comments

Comments
 (0)