Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 77 additions & 0 deletions .github/workflows/check_db_entities.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: check_db_entities

on:
pull_request:
paths:
- 'packages/stream_chat_persistence/**'

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="modified_entities"
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<<EOF" >> $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