81 lines
2.2 KiB
YAML
81 lines
2.2 KiB
YAML
name: "CodeQL Analysis"
|
|
|
|
on:
|
|
push:
|
|
branches: [ "main" ]
|
|
pull_request:
|
|
branches: [ "main" ]
|
|
schedule:
|
|
- cron: '38 13 * * 4'
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
env:
|
|
MAGEARGS: -d build/magefiles -w .
|
|
TARGETPLATFORM: linux/amd64
|
|
|
|
jobs:
|
|
codeql:
|
|
name: Analyze Go
|
|
runs-on: 'ubuntu-22.04'
|
|
permissions:
|
|
security-events: write
|
|
packages: read
|
|
actions: read
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- language: go
|
|
build-mode: manual
|
|
steps:
|
|
- name: Harden Runner
|
|
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
|
|
with:
|
|
egress-policy: block
|
|
allowed-endpoints: >
|
|
github.com:443
|
|
azure.archive.ubuntu.com:80
|
|
esm.ubuntu.com:443
|
|
ghcr.io:443
|
|
api.github.com:443
|
|
github.com:443
|
|
golang.org:443
|
|
motd.ubuntu.com:443
|
|
objects.githubusercontent.com:443
|
|
packages.microsoft.com:443
|
|
pkg-containers.githubusercontent.com:443
|
|
proxy.golang.org:443
|
|
raw.githubusercontent.com:443
|
|
storage.googleapis.com:443
|
|
uploads.github.com:443
|
|
- name: Checkout repository
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Setup Go
|
|
id: setup_go
|
|
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5
|
|
with:
|
|
go-version-file: 'go.mod'
|
|
- name: Install Mage
|
|
uses: magefile/mage-action@6a5dcb5fe61f43d7c08a98bc3cf9bc63c308c08e # v3
|
|
with:
|
|
install-only: true
|
|
- name: Install build deps
|
|
run: mage ${MAGEARGS} preps:deps
|
|
- name: Initialize CodeQL
|
|
uses: github/codeql-action/init@48ab28a6f5dbc2a99bf1e0131198dd8f1df78169 # v3.28.0
|
|
with:
|
|
languages: ${{ matrix.language }}
|
|
build-mode: ${{ matrix.build-mode }}
|
|
packs: githubsecuritylab/codeql-${{ matrix.language }}-queries
|
|
- if: matrix.build-mode == 'manual'
|
|
name: Build
|
|
run: go build
|
|
- name: Perform CodeQL Analysis
|
|
uses: github/codeql-action/analyze@48ab28a6f5dbc2a99bf1e0131198dd8f1df78169 # v3.28.0
|
|
with:
|
|
category: "/language:${{matrix.language}}"
|