mirror of
https://github.com/sonarsource/sonarcloud-github-action.git
synced 2026-06-08 21:17:10 +00:00
Accept triggering from GitHub event "pull_request"
This commit is contained in:
parent
c3b609966b
commit
34eca22d1c
2 changed files with 10 additions and 12 deletions
14
README.md
14
README.md
|
|
@ -27,14 +27,20 @@ sonar.sources=.
|
||||||
The workflow, usually declared in `.github/workflows/build.yml`, looks like:
|
The workflow, usually declared in `.github/workflows/build.yml`, looks like:
|
||||||
|
|
||||||
```yaml
|
```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
|
name: Main Workflow
|
||||||
jobs:
|
jobs:
|
||||||
sonarCloudTrigger:
|
sonarcloud:
|
||||||
name: SonarCloud Trigger
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@master
|
- uses: actions/checkout@v2
|
||||||
- name: SonarCloud Scan
|
- name: SonarCloud Scan
|
||||||
uses: sonarsource/sonarcloud-github-action@master
|
uses: sonarsource/sonarcloud-github-action@master
|
||||||
env:
|
env:
|
||||||
|
|
|
||||||
|
|
@ -17,14 +17,6 @@ if [[ -f "build.gradle" ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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
|
if [[ -z "${SONARCLOUD_URL}" ]]; then
|
||||||
SONARCLOUD_URL="https://sonarcloud.io"
|
SONARCLOUD_URL="https://sonarcloud.io"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue