From 748f1ae111a4cbe08828768452820b9e7fdcb395 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Wed, 2 Apr 2025 16:53:33 +0200 Subject: [PATCH 1/8] feat(ci): add check_db_entities workflow --- .github/workflows/check_db_entities.yml | 76 +++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 .github/workflows/check_db_entities.yml diff --git a/.github/workflows/check_db_entities.yml b/.github/workflows/check_db_entities.yml new file mode 100644 index 0000000000..84daca6b61 --- /dev/null +++ b/.github/workflows/check_db_entities.yml @@ -0,0 +1,76 @@ +name: 'Check Database Entity Modifications' +on: + pull_request: + paths: + - 'packages/stream_chat_persistence/lib/src/entity/**' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + check_entity_modifications: + runs-on: ubuntu-latest + steps: + - name: 📥 Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: 🔎 Check DB Entity Changes + id: check_entities + run: | + ENTITY_DIR="packages/stream_chat_persistence/lib/src/entity" + TEMP_FILE="touchedEntities" + BASE_BRANCH="${{ github.base_ref }}" + + echo "Using base branch: origin/$BASE_BRANCH for comparison" + + # Check if any entity files have changed compared to the base branch + git diff-index --name-only origin/$BASE_BRANCH -- $ENTITY_DIR | grep -E '\.dart$' > $TEMP_FILE || true + + if [ ! -s "$TEMP_FILE" ]; then + echo "✅ No entity files changed." + echo "has_changes=false" >> $GITHUB_OUTPUT + rm $TEMP_FILE + exit 0 + fi + + echo "⚠️ Entity files modified:" + cat $TEMP_FILE + + # Set modified files as output + echo "modified_files<> $GITHUB_OUTPUT + cat $TEMP_FILE >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + echo "has_changes=true" >> $GITHUB_OUTPUT + + - name: 🔍 Find Comment + if: steps.check_entities.outputs.has_changes == 'true' + uses: peter-evans/find-comment@v2 + id: find_comment + with: + issue-number: ${{ github.event.pull_request.number }} + comment-author: 'github-actions[bot]' + body-includes: 'Database Entity Files Modified' + + - name: 💬 Create or Update Comment + if: steps.check_entities.outputs.has_changes == 'true' + uses: peter-evans/create-or-update-comment@v2 + with: + comment-id: ${{ steps.find_comment.outputs.comment-id }} + issue-number: ${{ github.event.pull_request.number }} + body: | + ## ⚠️ Database Entity Files Modified + + The following database entity files have been modified in this PR: + ``` + ${{ steps.check_entities.outputs.modified_files }} + ``` + + ### 📝 Remember to: + 1. Update database version in `db/drift_chat_database.dart`. + 2. Update entity schema tests if necessary. + + *Note: This comment is automatically generated by the CI workflow.* + edit-mode: replace \ No newline at end of file From b13a45609ce17c4d0478b1a658a09a2ef74896ec Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Wed, 2 Apr 2025 16:55:04 +0200 Subject: [PATCH 2/8] chore: test push for workflow --- packages/stream_chat_persistence/lib/src/entity/polls.dart | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/stream_chat_persistence/lib/src/entity/polls.dart b/packages/stream_chat_persistence/lib/src/entity/polls.dart index f377301dba..053c4d9aac 100644 --- a/packages/stream_chat_persistence/lib/src/entity/polls.dart +++ b/packages/stream_chat_persistence/lib/src/entity/polls.dart @@ -7,6 +7,10 @@ import 'package:stream_chat_persistence/src/converter/voting_visibility_converte /// Represents a [Polls] table in [MoorChatDatabase]. @DataClassName('PollEntity') class Polls extends Table { + + + + /// The unique identifier of the poll. TextColumn get id => text()(); From f26ae0cc81528a47183f96f565ae6cc4713d0608 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Wed, 2 Apr 2025 16:57:21 +0200 Subject: [PATCH 3/8] Revert "chore: test push for workflow" This reverts commit b13a45609ce17c4d0478b1a658a09a2ef74896ec. --- packages/stream_chat_persistence/lib/src/entity/polls.dart | 4 ---- 1 file changed, 4 deletions(-) diff --git a/packages/stream_chat_persistence/lib/src/entity/polls.dart b/packages/stream_chat_persistence/lib/src/entity/polls.dart index 053c4d9aac..f377301dba 100644 --- a/packages/stream_chat_persistence/lib/src/entity/polls.dart +++ b/packages/stream_chat_persistence/lib/src/entity/polls.dart @@ -7,10 +7,6 @@ import 'package:stream_chat_persistence/src/converter/voting_visibility_converte /// Represents a [Polls] table in [MoorChatDatabase]. @DataClassName('PollEntity') class Polls extends Table { - - - - /// The unique identifier of the poll. TextColumn get id => text()(); From 979f0ba0091297bd13c5ab56a3a23deb6e8ba595 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Wed, 2 Apr 2025 17:02:43 +0200 Subject: [PATCH 4/8] chore: minor changes --- .github/workflows/check_db_entities.yml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/check_db_entities.yml b/.github/workflows/check_db_entities.yml index 84daca6b61..4b9594c767 100644 --- a/.github/workflows/check_db_entities.yml +++ b/.github/workflows/check_db_entities.yml @@ -1,8 +1,6 @@ -name: 'Check Database Entity Modifications' -on: - pull_request: - paths: - - 'packages/stream_chat_persistence/lib/src/entity/**' +name: check_db_entities + +on: [pull_request] concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -51,8 +49,8 @@ jobs: id: find_comment with: issue-number: ${{ github.event.pull_request.number }} - comment-author: 'github-actions[bot]' - body-includes: 'Database Entity Files Modified' + comment-author: github-actions[bot] + body-includes: Database Entity Files Modified - name: 💬 Create or Update Comment if: steps.check_entities.outputs.has_changes == 'true' From b2d623d533c71693234073a13318f2f0a9066df7 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Wed, 2 Apr 2025 17:11:37 +0200 Subject: [PATCH 5/8] chore: more minor changes --- .github/workflows/check_db_entities.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check_db_entities.yml b/.github/workflows/check_db_entities.yml index 4b9594c767..e130507c69 100644 --- a/.github/workflows/check_db_entities.yml +++ b/.github/workflows/check_db_entities.yml @@ -19,7 +19,7 @@ jobs: id: check_entities run: | ENTITY_DIR="packages/stream_chat_persistence/lib/src/entity" - TEMP_FILE="touchedEntities" + TEMP_FILE="modified_entities" BASE_BRANCH="${{ github.base_ref }}" echo "Using base branch: origin/$BASE_BRANCH for comparison" From d529e2c489daab685e7a5c0dad1a845ec3f888a4 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Wed, 2 Apr 2025 17:12:37 +0200 Subject: [PATCH 6/8] chore: add path filter to run only for persistence --- .github/workflows/check_db_entities.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check_db_entities.yml b/.github/workflows/check_db_entities.yml index e130507c69..c689b05c38 100644 --- a/.github/workflows/check_db_entities.yml +++ b/.github/workflows/check_db_entities.yml @@ -1,6 +1,9 @@ name: check_db_entities -on: [pull_request] +on: + pull_request: + paths: + - 'packages/stream_chat_persistence/**' concurrency: group: ${{ github.workflow }}-${{ github.ref }} From 29209a4e7c1157391d027b3d3fb117a253e6f249 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Wed, 2 Apr 2025 17:13:39 +0200 Subject: [PATCH 7/8] chore: temp changes --- packages/stream_chat_persistence/lib/src/entity/polls.dart | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/stream_chat_persistence/lib/src/entity/polls.dart b/packages/stream_chat_persistence/lib/src/entity/polls.dart index f377301dba..79c0b1331f 100644 --- a/packages/stream_chat_persistence/lib/src/entity/polls.dart +++ b/packages/stream_chat_persistence/lib/src/entity/polls.dart @@ -4,6 +4,8 @@ import 'package:stream_chat_persistence/src/converter/list_converter.dart'; import 'package:stream_chat_persistence/src/converter/map_converter.dart'; import 'package:stream_chat_persistence/src/converter/voting_visibility_converter.dart'; +// A temp comment to trigger check_db_entities workflow. + /// Represents a [Polls] table in [MoorChatDatabase]. @DataClassName('PollEntity') class Polls extends Table { From 4d8d3918522caf9081d81086a92e2556cb18e4ae Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Wed, 2 Apr 2025 17:14:56 +0200 Subject: [PATCH 8/8] Revert "chore: temp changes" This reverts commit 29209a4e7c1157391d027b3d3fb117a253e6f249. --- packages/stream_chat_persistence/lib/src/entity/polls.dart | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/stream_chat_persistence/lib/src/entity/polls.dart b/packages/stream_chat_persistence/lib/src/entity/polls.dart index 79c0b1331f..f377301dba 100644 --- a/packages/stream_chat_persistence/lib/src/entity/polls.dart +++ b/packages/stream_chat_persistence/lib/src/entity/polls.dart @@ -4,8 +4,6 @@ import 'package:stream_chat_persistence/src/converter/list_converter.dart'; import 'package:stream_chat_persistence/src/converter/map_converter.dart'; import 'package:stream_chat_persistence/src/converter/voting_visibility_converter.dart'; -// A temp comment to trigger check_db_entities workflow. - /// Represents a [Polls] table in [MoorChatDatabase]. @DataClassName('PollEntity') class Polls extends Table {