Skip to content

👷 Added Sonar-Scan #10

👷 Added Sonar-Scan

👷 Added Sonar-Scan #10

Workflow file for this run

name: Run Tests
on:
pull_request:
branches:
- "main"
workflow_dispatch:
concurrency:
group: ${{ github.head_ref || github.ref }}
jobs:
test:
name: Run Tests
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.BOT_TOKEN }}
- name: Load dependencies
run: npm ci
- name: Format code
run: npm run format-all
- name: Add corresponding commit
if: "!contains(github.event.head_commit.message, '🎨 Code formatted')"
run: |
git config --global user.name 'OpenFoxes Maintenance Bot'
git config --global user.email '[email protected]'
git checkout ${{ github.event.pull_request.head.ref }}
git add .
git diff-index --quiet ${{ github.event.pull_request.head.ref }} || {
git commit -m "🎨 Code formatted"
git push origin ${{ github.event.pull_request.head.ref }}
}
- name: Run all tests
run: npm run test-cov
- name: Upload results to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload scan to Sonar
uses: SonarSource/sonarqube-scan-action@v4
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}