Skip to content

Commit

Permalink
workflow: Use more secure pull_request trigger and fix SonarQube (bot…
Browse files Browse the repository at this point in the history
…tlesdevs#3034)

* Use more secure pull_request trigger

* Fix sonarqube
  • Loading branch information
koplo199 authored Aug 18, 2023
1 parent 847070d commit fbab5f1
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 16 deletions.
17 changes: 1 addition & 16 deletions .github/workflows/mypy.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
on:
pull_request_target:
pull_request:
types: [opened, synchronize, reopened]

name: Mypy
Expand All @@ -10,8 +10,6 @@ jobs:
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
fetch-depth: 0
- name: Set up Python 3.10
uses: actions/setup-python@v4
Expand All @@ -31,16 +29,3 @@ jobs:
run: |
mypy --version
mypy bottles
sonar:
name: Sonar
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- uses: sonarsource/sonarqube-scan-action@master
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
24 changes: 24 additions & 0 deletions .github/workflows/sonar.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
on:
pull_request_target:
types: [opened, synchronize, reopened]

name: Sonar
jobs:
sonar:
name: Checker
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- uses: sonarsource/sonarqube-scan-action@master
with:
args: >
-Dsonar.pullrequest.key=${{ github.event.pull_request.number }}
-Dsonar.pullrequest.branch=${{ github.head_ref }}
-Dsonar.pullrequest.base=${{ github.base_ref }}
-Dsonar.scm.revision=${{ github.event.pull_request.head.sha }}
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}

0 comments on commit fbab5f1

Please sign in to comment.