Skip to content

Commit

Permalink
fix(CI): fix PR compliance test when diff is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
epignatelli committed Jan 29, 2023
1 parent 70c0834 commit 3661a15
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,12 @@ jobs:
pip install pylint
PR_BRANCH=${{ github.event.pull_request.target.ref }}
MAIN_BRANCH=origin/${{ github.event.pull_request.base.ref }}
MESSAGE=$(pylint -ry --disable=E0401 `git diff --name-only --diff-filter=d $MAIN_BRANCH $PR_BRANCH | grep -E '\.py$' | tr '\n' ' '` ||:)
CURRENT_DIFF=$(git diff --name-only --diff-filter=d $MAIN_BRANCH $PR_BRANCH | grep -E '\.py$' | tr '\n' ' ')
if [[ $CURRENT_DIFF == "" ]];
then MESSAGE="Diff is empty and there is nothing to pylint."
else
MESSAGE=$(pylint -ry --disable=E0401 $CURRENT_DIFF ||:)
fi
echo 'MESSAGE<<EOF' >> $GITHUB_ENV
echo "<pre><code>$MESSAGE</code></pre>" >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
Expand Down

0 comments on commit 3661a15

Please sign in to comment.