From 34eca22d1c5760f6ec08cb4b5c2f026796eb8e30 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Mon, 30 Mar 2020 19:48:28 +0200 Subject: [PATCH] Accept triggering from GitHub event "pull_request" --- README.md | 14 ++++++++++---- entrypoint.sh | 8 -------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 09e5664..bbd5945 100644 --- a/README.md +++ b/README.md @@ -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: diff --git a/entrypoint.sh b/entrypoint.sh index 4820677..079cb96 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -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