|
|
@@ -16,6 +16,12 @@ on:
|
|
|
builder:
|
|
|
required: true
|
|
|
type: string
|
|
|
+ before_ref:
|
|
|
+ required: true
|
|
|
+ type: string
|
|
|
+ after_ref:
|
|
|
+ required: true
|
|
|
+ type: string
|
|
|
|
|
|
env:
|
|
|
IS_CI: "yes"
|
|
|
@@ -34,20 +40,12 @@ jobs:
|
|
|
with:
|
|
|
fetch-depth: 0
|
|
|
- name: run
|
|
|
+ env:
|
|
|
+ BEFORE_REF: ${{ inputs.before_ref }}
|
|
|
+ AFTER_REF: ${{ inputs.after_ref }}
|
|
|
run: |
|
|
|
git config --global --add safe.directory "$GITHUB_WORKSPACE"
|
|
|
- echo "git diff base: $GITHUB_BASE_REF"
|
|
|
- if [[ "$GITHUB_BASE_REF" =~ [0-9a-f]{8,40} ]]; then
|
|
|
- # base is a commit sha1
|
|
|
- compare_base="$GITHUB_BASE_REF"
|
|
|
- else
|
|
|
- repo="${GITHUB_REPOSITORY}"
|
|
|
- git remote -v
|
|
|
- remote="$(git remote -v | grep -E "github\.com(:|/)$repo((\.git)|(\s))" | grep fetch | awk '{print $1}')"
|
|
|
- git fetch "$remote" "$GITHUB_BASE_REF"
|
|
|
- compare_base="$remote/$GITHUB_BASE_REF"
|
|
|
- fi
|
|
|
- changed_files="$(git diff --name-only ${compare_base} HEAD apps/emqx)"
|
|
|
+ changed_files="$(git diff --name-only ${BEFORE_REF} ${AFTER_REF} apps/emqx)"
|
|
|
if [ "$changed_files" = '' ]; then
|
|
|
echo "nothing changed in apps/emqx, ignored."
|
|
|
exit 0
|