Skip to content

Commit

Permalink
Reusable codeql workflow (#12)
Browse files Browse the repository at this point in the history
* Create reusable-codeql.yml
  • Loading branch information
waybackarchiver authored Nov 7, 2022
1 parent 393215c commit e231b05
Showing 1 changed file with 86 additions and 0 deletions.
86 changes: 86 additions & 0 deletions .github/workflows/reusable-codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Copyright 2020 Wayback Archiver. All rights reserved.
# Use of this source code is governed by the MIT license
# that can be found in the LICENSE file.

name: CodeQL

on:
workflow_call:
inputs:
language:
type: string
description: 'Languages used in code base'
config-file:
type: string
description: 'Configuration file of CodeQL.'

permissions:
contents: read

jobs:
codeql:
name: CodeQL Analysis
runs-on: ubuntu-latest
permissions:
security-events: write
actions: read
contents: read
steps:
- name: Harden Runner
uses: step-security/harden-runner@2e205a28d0e1da00c5f53b161f4067b052c61f34 # v1.5.0
with:
egress-policy: block
disable-telemetry: true
allowed-endpoints: >
github.com:443
api.github.com:443
uploads.github.com:443
proxy.golang.org:443
sum.golang.org:443
storage.googleapis.com:443
- name: Check out code base
if: github.event_name == 'push'
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
with:
fetch-depth: 0
persist-credentials: false

- name: Check out code base
if: github.event_name == 'pull_request'
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
with:
fetch-depth: 0
persist-credentials: false
ref: ${{ github.event.pull_request.head.sha }}

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@f0a12816612c7306b485a22cb164feb43c6df818 # v2.11.2
with:
languages: ${{ inputs.language }}
config-file: ${{ inputs.config-file }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# 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@f0a12816612c7306b485a22cb164feb43c6df818 # v2.11.2

# ℹ️ 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@f0a12816612c7306b485a22cb164feb43c6df818 # v2.11.2

0 comments on commit e231b05

Please sign in to comment.