diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 541f69080..0039d59af 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,6 +18,7 @@ jobs: preBuild: runs-on: ubuntu-20.04 + if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository }} outputs: version: ${{ steps.version.outputs.value }} @@ -446,14 +447,16 @@ jobs: steps: - name: Prepare Discord message run: | - result=SUCCESS - expr ${{ join(needs.*.outputs.warnings, ' + ') }} && result=WARNING - echo ${{ join(needs.*.result, ' ') }} | grep -q fail && result=FAILED - echo ${{ join(needs.*.result, ' ') }} | grep -q cancel && result=CANCELLED + result=SKIPPED + ${{ contains(needs.*.result, 'success') }} && result=SUCCESS + ${{ contains(needs.*.outputs.warnings, 'true') }} && result=WARNING + ${{ contains(needs.*.result, 'cancelled') }} && result=CANCELLED + ${{ contains(needs.*.result, 'failure') }} && result=FAILED + [[ $result = SKIPPED ]] && emoji=repeat [[ $result = SUCCESS ]] && emoji=white_check_mark [[ $result = WARNING ]] && emoji=warning - [[ $result = FAILED ]] && emoji=x [[ $result = CANCELLED ]] && emoji=grey_question + [[ $result = FAILED ]] && emoji=x echo "::set-env name=result::$result" echo "::set-env name=emoji::$emoji" - name: Send Discord message diff --git a/scripts/warnings.pl b/scripts/warnings.pl index d1adb0b41..0962787d6 100644 --- a/scripts/warnings.pl +++ b/scripts/warnings.pl @@ -31,10 +31,9 @@ while (<<>>) ++$cmds{"::warning file=$result{file}::$result{msg}"}; } } -my @cmds = sort keys %cmds; -my $count = scalar @cmds; -print "$_\n" for @cmds; -print "::set-output name=warnings::$count\n"; +my $bool = %cmds ? 'true' : 'false'; +print "$_\n" for sort keys %cmds; +print "::set-output name=warnings::$bool\n"; sub extractWarning {