Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CodeQL Action Fails to Find eslint-results.sarif: Path Does Not Exist Error #2285

Open
chdonncha opened this issue May 12, 2024 · 1 comment

Comments

@chdonncha
Copy link

chdonncha commented May 12, 2024

Always getting the follow error when running the default CodeQL upload action, seen this has been raised before but no solution found.

Warning: CodeQL Action v2 will be deprecated on December 5th, 2024. Please update all occurrences of the CodeQL Action in your workflow files to v3. For more information, see https://github.blog/changelog/2024-01-12-code-scanning-deprecation-of-codeql-action-v2/
Error: Path does not exist: eslint-results.sarif
ConfigurationError: Path does not exist: eslint-results.sarif
    at getSarifFilePaths (/home/runner/work/_actions/github/codeql-action/v2/lib/upload-lib.js:2[9](https://github.com/********/********/actions/runs/9045918875/job/24867198772?pr=11#step:5:10)0:15)
    at Object.uploadFromActions (/home/runner/work/_actions/github/codeql-action/v2/lib/upload-lib.js:284:30)
    at run (/home/runner/work/_actions/github/codeql-action/v2/lib/upload-sarif-action.js:56:47)
    at async runWrapper (/home/runner/work/_actions/github/codeql-action/v2/lib/upload-sarif-action.js:84:9)

Action:

name: ESLint

on:
  push:
    branches: [ "master" ]
  pull_request:
    branches: [ "master" ]
  schedule:
    - cron: '38 15 * * 3'

jobs:
  eslint:
    name: Run eslint scanning
    runs-on: ubuntu-latest
    permissions:
      contents: read
      security-events: write
      actions: read
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Install ESLint
        run: |
          npm install eslint@8.10.0
          npm install @microsoft/eslint-formatter-sarif@2.1.7

      - name: Run ESLint
        run: npx eslint .
          --config .eslintrc.js
          --ext .js,.jsx,.ts,.tsx
          --format @microsoft/eslint-formatter-sarif
          --output-file eslint-results.sarif
        continue-on-error: true

      - name: Upload analysis results to GitHub
        uses: github/codeql-action/upload-sarif@v2
        with:
          sarif_file: eslint-results.sarif
          token: ${{ secrets.GITHUB_TOKEN }}
          wait-for-processing: true
@aeisenberg
Copy link
Contributor

Can you determine the full path to eslint-results.sarif? If so, use a full path to sarif_file. My guess is that eslint is not placing the file in the expected directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants