Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
Hansrajr committed Sep 24, 2024
1 parent 696e2b5 commit 790b1bf
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 11 deletions.
33 changes: 33 additions & 0 deletions .github/scripts/create-file.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash

# Create the directory if it doesn't exist
mkdir -p .github/workflows

# Create the sonar-scan.yml file
cat <<EOL > .github/workflows/sonar-scan.yml
on:
push:
branches:
- '*'
name: Sonar Scan Workflow
jobs:
sonarqube:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: SonarQube Scan
uses: sonarsource/[email protected]
env:
SONAR_TOKEN: ''
SONAR_HOST_URL: ''
with:
args: >
-Dsonar.python.coverage.reportPaths=coverage.xml
-Dsonar.projectKey=''
-Dsonar.projectName=''
EOL

echo "Sonar scan workflow file created at .github/workflows/sonar-scan.yml"
28 changes: 17 additions & 11 deletions .github/workflows/sonar.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
on:
push:
# Trigger analysis when pushing to your main branches, and when creating a pull request.
workflow_dispatch:
inputs:
branch_name:
description: 'Name of the branch'
required: true

name: Sonar Scan Workflow
jobs:
Expand All @@ -10,13 +15,14 @@ jobs:
with:
# Disabling shallow clones is recommended for improving the relevancy of reporting
fetch-depth: 0
- name: SonarQube Scan
uses: sonarsource/[email protected] # See the latest version at https://github.com/marketplace/actions/official-sonarqube-scan
env:
SONAR_TOKEN: 'sqp_80a1df8514cf911b719c5a362c7658ee3deff62f'
SONAR_HOST_URL: 'https://sq.beehyv.com'
with:
args: >
-Dsonar.python.coverage.reportPaths=coverage.xml
-Dsonar.projectKey=Okahu
-Dsonar.projectName='Okahu'
- name: Copy file to branch
run: |
git checkout ${{inputs.branch_name}}
bash create-file.sh
git status
git add .github/workflows/sonar-scan.yml
git config --local user.name "github-actions"
git config --local user.email "[email protected]"
git commit -m "Add file for SonarQube analysis"
git push origin ${{inputs.branch_name}}

0 comments on commit 790b1bf

Please sign in to comment.