The Wayback Machine - https://web.archive.org/web/20200611210444/https://github.com/github/codeql-action
Skip to content
Actions for running CodeQL analysis
TypeScript CodeQL JavaScript C# PowerShell Ruby Other
Branch: master
Clone or download

Latest commit

Latest commit 1f2cca0 Jun 10, 2020

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github pass queries to codeql via a file Jun 1, 2020
analyze Use the full amount of memory available when running queries. May 14, 2020
autobuild Initial commit (from f5274cbdce4ae7c9e4b937dcdf95ac70ae436d5f) Apr 28, 2020
init update codeql bundle version Jun 1, 2020
lib fix typos Jun 9, 2020
node_modules replace jest with ava May 13, 2020
queries Make use of getContainer May 4, 2020
src fix typos Jun 9, 2020
tests/multi-language-repo Fix gemfile May 8, 2020
upload-sarif Initial commit (from f5274cbdce4ae7c9e4b937dcdf95ac70ae436d5f) Apr 28, 2020
.gitattributes Initial commit (from f5274cbdce4ae7c9e4b937dcdf95ac70ae436d5f) Apr 28, 2020
CODE_OF_CONDUCT.md Initial commit (from f5274cbdce4ae7c9e4b937dcdf95ac70ae436d5f) Apr 28, 2020
CONTRIBUTING.md Initial commit (from f5274cbdce4ae7c9e4b937dcdf95ac70ae436d5f) Apr 28, 2020
LICENSE Initial commit (from f5274cbdce4ae7c9e4b937dcdf95ac70ae436d5f) Apr 28, 2020
README.md Update CodeQL link in README Jun 9, 2020
jest.config.js Initial commit (from f5274cbdce4ae7c9e4b937dcdf95ac70ae436d5f) Apr 28, 2020
package-lock.json replace jest with ava May 13, 2020
package.json add tests for config-utils May 14, 2020
tsconfig.json enable source maps May 14, 2020
tslint.json Initial commit (from f5274cbdce4ae7c9e4b937dcdf95ac70ae436d5f) Apr 28, 2020

README.md

CodeQL Action

This action runs GitHub's industry-leading static analysis engine, CodeQL, against a repository's source code to find security vulnerabilities. It then automatically uploads the results to GitHub so they can be displayed in the repository's security tab. CodeQL runs an extensible set of queries, which have been developed by the community and the GitHub Security Lab to find common vulnerabilities in your code.

License

This project is released under the MIT License.

The underlying CodeQL CLI, used in this action, is licensed under the GitHub CodeQL Terms and Conditions. As such, this action may be used on open source projects hosted on GitHub, and on private repositories that are owned by an organisation with GitHub Advanced Security enabled.

Usage

This is a short walkthrough, but for more information read configuring code scanning.

To get code scanning results from CodeQL analysis on your repo you can use the following workflow as a template:

name: "Code Scanning - Action"

on:
  push:
  pull_request:
  schedule:
    - cron: '0 0 * * 0'

jobs:
  CodeQL-Build:

    strategy:
      fail-fast: false

    # CodeQL runs on ubuntu-latest, windows-latest, and macos-latest
    runs-on: ubuntu-latest

    steps:
      - name: Checkout repository
        uses: actions/checkout@v2
        with:
          # Must fetch at least the immediate parents so that if this is
          # a pull request then we can checkout the head of the pull request.
          # Only include this option if you are running this workflow on pull requests.
          fetch-depth: 2

      # If this run was triggered by a pull request event then checkout
      # the head of the pull request instead of the merge commit.
      # Only include this step if you are running this workflow on pull requests.
      - run: git checkout HEAD^2
        if: ${{ github.event_name == 'pull_request' }}

      # Initializes the CodeQL tools for scanning.
      - name: Initialize CodeQL
        uses: github/codeql-action/init@v1
        # Override language selection by uncommenting this and choosing your languages
        # with:
        #   languages: go, javascript, csharp, python, cpp, java

      # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
      # If this step fails, then you should remove it and run the build manually (see below).
      - name: Autobuild
        uses: github/codeql-action/autobuild@v1

      # ℹ️ Command-line programs to run using the OS shell.
      # 📚 https://git.io/JvXDl

      # ✏️ If the Autobuild fails above, remove it and uncomment the following
      #    three lines and modify them (or add more) to build your code if your
      #    project uses a compiled language

      #- run: |
      #   make bootstrap
      #   make release

      - name: Perform CodeQL Analysis
        uses: github/codeql-action/analyze@v1

If you prefer to integrate this within an existing CI workflow, it should end up looking something like this:

- name: Initialize CodeQL
  uses: github/codeql-action/init@v1
  with:
    languages: go, javascript

# Here is where you build your code
- run: |
  make bootstrap
  make release

- name: Perform CodeQL Analysis
  uses: github/codeql-action/analyze@v1

Configuration file

Use the config-file parameter of the init action to enable the configuration file. The value of config-file is the path to the configuration file you want to use. This example loads the configuration file ./.github/codeql/codeql-config.yml.

- uses: github/codeql-action/init@v1
  with:
    config-file: ./.github/codeql/codeql-config.yml

The configuration file must be located within the local repository. For information on how to write a configuration file, see "Using a custom configuration."

Troubleshooting

Read about troubleshooting code scanning.

You can’t perform that action at this time.