Skip to content

CodeQL

CodeQL #365

# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
on:
push:
branches: [ primary ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ primary ]
schedule:
- cron: '39 5 * * 3'
jobs:
analyze:
name: Analyze
runs-on: windows-2019
strategy:
fail-fast: false
matrix:
language: [ 'csharp', 'javascript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
steps:
- name: Checkout repository
uses: actions/checkout@v3.3.0
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# 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@v2
# ℹ️ 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: |
# Checks-out repository under $GITHUB_WORKSPACE, so job can access it
- uses: actions/checkout@v3.3.0
with:
ref: ${{ github.event.inputs.branch }}
# Add MSBuild to environment path
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.1.3
# copy dependencies over
- name: Copy Dependencies folder from the repo to Build for MP signing and show them
run: |
Copy-Item -Path ManagementPack\2016\dependencies -Destination "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VSAC\" -Recurse
Get-ChildItem "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VSAC\"
# Build the Settings UI dll
- name: Compile SMLetsExchangeConnectorSettingsUI.dll
run: msbuild ManagementPack/2016/SMLetsExchangeConnectorSettingsUI/SMLetsExchangeConnectorSettingsUI.csproj
#change the MPB version
- name: Change the next MPB build version
run: |
[xml]$build = Get-Content ManagementPack\2016\SMLets.Exchange.Connector\SMLets.Exchange.Connector.mpproj
$build.Project.PropertyGroup[0].Version = "${{ github.event.inputs.version }}"
$build.Project.PropertyGroup[1].Copyright = "AdhocAdam, " + (Get-Date).Year + "."
$build.Save("ManagementPack\2016\SMLets.Exchange.Connector\SMLets.Exchange.Connector.mpproj")
# Convert Management Pack Fragments to single XML, seal it to create the MP, bind the DLL to it, and thus create the MPB
- name: Sign the XML to create the MP. Then combine the MP and DLL to create the MPB
run: msbuild ManagementPack/2016/SMLets.Exchange.Connector.sln
#change the Resources.DLL version
- name: Change the SMLets.Exchange.Connector.Resources.dll File Assembly version
run: |
$newVersion = "${{ github.event.inputs.version }}"
$originalAssembly = Get-Content -path ManagementPack\2016\SMLets.Exchange.Connector.Resources\Properties\AssemblyInfo.cs
$assemblyFileVersion = $originalAssembly[$originalAssembly.Length - 1]
$originalAssembly.Replace($assemblyFileVersion, '[assembly: AssemblyFileVersion("' + $newVersion + '")]') | Out-File ManagementPack\2016\SMLets.Exchange.Connector.Resources\Properties\AssemblyInfo.cs
# Create the SMLets.Exchange.Connector.Resources.dll for those using the connector with the SCSM workflow engine
- name: Compile the SMLets.Exchange.Connector.Resources.dll
run: msbuild ManagementPack\2016\SMLets.Exchange.Connector.Resources\SMLets.Exchange.Connector.Resources.csproj
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2