mirror of
https://github.com/sonarsource/sonarcloud-github-action.git
synced 2026-06-06 10:47:09 +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:
|
||||
|
||||
```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:
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue