I am using SonarCloud and I am trying to run the GitHub workflow on a Linux based self-hosted runner. I have a workflow for frontend javascript, typescript project and everytime the scan runs, the subsequent scans fail stating that
File was unable to be removed Error: EACCES: permission denied, unlink ‘scannerwork/.sonar_lock’
I will have to manually delete the sonar_lock file and then only the other scans run.
This issue doesn’t happen when I run the sonar scan workflow for a BE project (.Net) on the self-hosted runner. It only happens for the FE workflow as below.
This is the workflow I am running
sonarcloud-scan-frontend:
needs: changes
runs-on: self-hosted
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: set node to 16
uses: actions/setup-node@v3
with:
node-version: "16"
- name: set npm to 6
run: npm i -g npm@6
- name: install dependencies
working-directory: ./UI/QueryBuilder
run: npm ci
- name: run tests
working-directory: ./UI/QueryBuilder
run: npm test --coverage --coverageReporters lcov
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
projectBaseDir: ./UI/QueryBuilder
What am I missing here?