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:
parent
3d5786d982
commit
7d35afd30d
1 changed files with 9 additions and 2 deletions
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue