Update main.yml #11
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
build: | |
name: Build and Scan | |
runs-on: ubuntu-latest | |
env: | |
GIT_TOKEN: ${{ secrets.GIT_TOKEN }} | |
REPO_URL: https://github.com/MindPatch/hacking-lab/ | |
SONAR_PROJECTKEY: MW1y0ahWyGjulTZd | |
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Pull Blacklock Code Scanner Docker Image | |
run: docker pull blacklocksec/code-scanner:latest | |
- name: Run Blacklock Code Scanner | |
run: | | |
docker run --rm -v $(pwd):/app \ | |
-e SONAR_PROJECTKEY=${{ env.SONAR_PROJECTKEY }} \ | |
-e SONAR_HOST_URL=${{ env.SONAR_HOST_URL }} \ | |
-e SONAR_TOKEN=${{ env.SONAR_TOKEN }} \ | |
-e GIT_TOKEN=${{ env.GIT_TOKEN }} \ | |
-e REPO_URL=${{ env.REPO_URL }} \ | |
blacklocksec/code-scanner:latest | |
- name: Run SonarQube Scan | |
uses: sonarsource/sonarqube-scan-action@master | |
env: | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} | |
# If you wish to fail your job when the Quality Gate is red, uncomment the | |
# following lines. This would typically be used to fail a deployment. | |
# - uses: sonarsource/sonarqube-quality-gate-action@master | |
# timeout-minutes: 5 | |
# env: | |
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |