CodeQL - Complete analysis #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "CodeQL - Complete analysis" | |
on: | |
schedule: | |
- cron: '44 23 12 * *' # Run CodeQL scan on a day of every month at 11:44 PM UTC | |
jobs: | |
analyze: | |
name: Analyze | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 # Set timeout to 30 minutes; Change if your project takes longer to scan | |
permissions: | |
actions: read | |
contents: read | |
security-events: write | |
strategy: | |
fail-fast: false | |
matrix: | |
language: [ 'ruby' ] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
# This step will try to find a Dockerfile in the repository and extract the Ruby version from it. | |
# If you don't use Docker, you can remove this step and add the Ruby version directly to the | |
# ruby-version parameter in the `ruby/setup-ruby` step below. | |
- name: Find Ruby version in Dockerfile | |
id: find-ruby-version-in-dockerfile | |
run: | | |
ruby_version=$(find . -name Dockerfile -exec sed -En 's/^FROM ruby:([0-9.]+)(.*)/\1/p' {} \; | head -1) | |
if [ -z "$ruby_version" ]; then | |
echo "No Dockerfile found, using default Ruby version" | |
ruby_version="2.7" | |
else | |
echo "Found Dockerfile, using Ruby version $ruby_version" | |
fi | |
echo USE_RUBY_VERSION=$ruby_version >> $GITHUB_OUTPUT | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{ steps.find-ruby-version-in-dockerfile.outputs.USE_RUBY_VERSION }} # The version of Ruby to use | |
bundler-cache: true # runs 'bundle install' and caches installed gems automatically | |
#env: | |
# BUNDLE_GEMFILE: ./path/to/Gemfile # Change this to the path to your Gemfile if not in root | |
# Initializes the CodeQL tools for scanning. | |
- name: Initialize CodeQL | |
uses: github/codeql-action/init@v3 | |
with: | |
languages: ${{ matrix.language }} | |
# queries: security-extended,security-and-quality | |
# debug: true # Only use this for debugging. It will increase the runtime of the action and take up storage | |
- name: Perform CodeQL Analysis | |
uses: github/codeql-action/analyze@v3 | |
with: | |
category: "/language:${{matrix.language}}" |