Accept triggering from GitHub event "pull_request"

This commit is contained in:
Simon Brandhof 2020-03-30 19:48:28 +02:00
commit 34eca22d1c
2 changed files with 10 additions and 12 deletions

View file

@ -27,14 +27,20 @@ sonar.sources=.
The workflow, usually declared in `.github/workflows/build.yml`, looks like:
```yaml
on: push
on:
# Trigger analysis when pushing in master or pull requests, and when creating
# a pull request.
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]
name: Main Workflow
jobs:
sonarCloudTrigger:
name: SonarCloud Trigger
sonarcloud:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v2
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
env:

View file

@ -17,14 +17,6 @@ if [[ -f "build.gradle" ]]; then
exit 1
fi
if [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]]; then
EVENT_ACTION=$(jq -r ".action" "${GITHUB_EVENT_PATH}")
if [[ "${EVENT_ACTION}" != "opened" ]]; then
echo "No need to run analysis. It is already triggered by the push event."
exit 78
fi
fi
if [[ -z "${SONARCLOUD_URL}" ]]; then
SONARCLOUD_URL="https://sonarcloud.io"
fi