chore(ci): fix apidiff handling of empty set
@@ -18,23 +18,23 @@ jobs:
id: changed_dirs
# Ignore changes to the internal and root directories.
run: |
- tree=$(git diff-tree --no-commit-id --name-only --diff-filter=DMR -r ${{ steps.main.outputs.hash }}..HEAD)
- uniques=$(echo $tree | xargs -r -L1 dirname | uniq)
- dirs=$(echo $uniques | grep -v -e 'internal' -e '\.' | cat)
+ dirs=$(git diff-tree --no-commit-id --name-only --diff-filter=DMR -r ${{ steps.main.outputs.hash }}..HEAD | xargs -r -L1 dirname | uniq | grep -v -e 'internal' -e '\.' | cat)
if [ -z "$dirs" ]
then
- echo "changed={\"changed\":[]}" >> $GITHUB_OUTPUT
+ echo "skip=1" >> $GITHUB_OUTPUT
echo "No changes worth diffing!"
else
for d in $dirs; do list=${list},\"${d}\"; done
echo "changed={\"changed\":[${list#,}]}" >> $GITHUB_OUTPUT
+ echo "skip=" >> $GITHUB_OUTPUT
fi
outputs:
changed_dirs: ${{ steps.changed_dirs.outputs.changed }}
+ skip: ${{ steps.changed_dirs.outputs.skip }}
apidiff:
needs: scan_changes
runs-on: ubuntu-latest
- if: "!contains(github.event.pull_request.labels.*.name, 'breaking change allowed')"
+ if: "!needs.scan_changes.outputs.skip && !contains(github.event.pull_request.labels.*.name, 'breaking change allowed')"
continue-on-error: true
strategy:
matrix: ${{ fromJson(needs.scan_changes.outputs.changed_dirs) }}
@@ -47,7 +47,7 @@ jobs:
- uses: actions/checkout@v3
with:
ref: main
- - name: Baseline name
+ - name: Create baseline
id: baseline
run: |
export CHANGED=${{ matrix.changed }}
