0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-16 20:26:19 -05:00

fix: fix the db alter detect ci script (#5210)

fix the db alter detect ci script
This commit is contained in:
simeng-li 2024-01-08 18:31:46 +08:00 committed by GitHub
parent 3d5786d982
commit 7d35afd30d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -23,11 +23,18 @@ jobs:
fetch-depth: 0
# compare the current codebase with HEAD and check if there are any changes under the alterations folder
# if the event is a pull request, we need to compare the merge base with HEAD, otherwise we compare the current commit with the previous commit
- name: Check for alteration changes
id: changes-detection
run: |
MERGE_BASE=$(git merge-base origin/${{github.base_ref}} HEAD)
CHANGE_FILES=$(git diff --name-only $MERGE_BASE | grep 'packages/schemas/alterations/' || true)
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
BASE=$(git merge-base origin/${{github.base_ref}} HEAD)
else
BASE=${{ github.event.before }}
fi
CHANGE_FILES=$(git diff --name-only $BASE | grep 'packages/schemas/alterations/' || true)
if [ -n "$CHANGE_FILES" ]; then
echo "$CHANGE_FILES"
echo "::set-output name=has-alteration-changes::true"