Skip to content

Commit d5a0ef3

Browse files
chore: update branch protection rules, codeql (#1076)
* chore: enable codeql * chore: update branch protection rules * update autobuild directory * include recursive submodules upon checkout --------- Co-authored-by: Michael Mainer <[email protected]>
1 parent f509364 commit d5a0ef3

File tree

2 files changed

+95
-7
lines changed

2 files changed

+95
-7
lines changed

.github/policies/MSGraph-SDK-Code-Generator-branch-protection.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ configuration:
1010
branchProtectionRules:
1111

1212
- branchNamePattern: dev
13-
# This branch pattern applies to the following branches as of 06/12/2023 10:31:12:
13+
# This branch pattern applies to the following branches:
1414
# dev
1515

1616
# Specifies whether this branch can be deleted. boolean
@@ -30,21 +30,22 @@ configuration:
3030
# Are commits required to be signed. boolean. TODO: all contributors must have commit signing on local machines.
3131
requiresCommitSignatures: false
3232
# Are conversations required to be resolved before merging? boolean
33-
requiresConversationResolution: false
33+
requiresConversationResolution: true
3434
# Are merge commits prohibited from being pushed to this branch. boolean
3535
requiresLinearHistory: false
3636
# Required status checks to pass before merging. Values can be any string, but if the value does not correspond to any existing status check, the status check will be stuck on pending for status since nothing exists to push an actual status
3737
requiredStatusChecks:
3838
- build
39+
- CodeQL
3940
# Require branches to be up to date before merging. Requires requiredStatusChecks. boolean
40-
requiresStrictStatusChecks: false
41+
requiresStrictStatusChecks: true
4142
# Indicates whether there are restrictions on who can push. boolean. Should be set with whoCanPush.
4243
restrictsPushes: false
4344
# Restrict who can dismiss pull request reviews. boolean
4445
restrictsReviewDismissals: false
4546

4647
- branchNamePattern: main
47-
# This branch pattern applies to the following branches as of 06/12/2023 10:31:12:
48+
# This branch pattern applies to the following branches:
4849
# main
4950

5051
# Specifies whether this branch can be deleted. boolean
@@ -64,14 +65,15 @@ configuration:
6465
# Are commits required to be signed. boolean. TODO: all contributors must have commit signing on local machines.
6566
requiresCommitSignatures: false
6667
# Are conversations required to be resolved before merging? boolean
67-
requiresConversationResolution: false
68+
requiresConversationResolution: true
6869
# Are merge commits prohibited from being pushed to this branch. boolean
6970
requiresLinearHistory: false
7071
# Required status checks to pass before merging. Values can be any string, but if the value does not correspond to any existing status check, the status check will be stuck on pending for status since nothing exists to push an actual status
7172
requiredStatusChecks:
7273
- build
73-
# Require branches to be up to date before merging. Requires requiredStatusChecks. boolean
74-
requiresStrictStatusChecks: false
74+
- CodeQL
75+
# Require branches to be up to date before merging. boolean
76+
requiresStrictStatusChecks: true
7577
# Indicates whether there are restrictions on who can push. boolean. Should be set with whoCanPush.
7678
restrictsPushes: false
7779
# Restrict who can dismiss pull request reviews. boolean

.github/workflows/codeql.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
14+
on:
15+
push:
16+
branches: [ "dev", "main" ]
17+
pull_request:
18+
# The branches below must be a subset of the branches above
19+
branches: [ "dev" ]
20+
schedule:
21+
- cron: '1 * * * 1' # At minute 0 on Monday
22+
23+
jobs:
24+
analyze:
25+
name: Analyze
26+
# Runner size impacts CodeQL analysis time. To learn more, please see:
27+
# - https://gh.io/recommended-hardware-resources-for-running-codeql
28+
# - https://gh.io/supported-runners-and-hardware-resources
29+
# - https://gh.io/using-larger-runners
30+
# Consider using larger runners for possible analysis time improvements.
31+
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
32+
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
33+
permissions:
34+
actions: read
35+
contents: read
36+
security-events: write
37+
38+
strategy:
39+
fail-fast: false
40+
matrix:
41+
language: [ 'csharp' ]
42+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby', 'swift' ]
43+
# Use only 'java' to analyze code written in Java, Kotlin or both
44+
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
45+
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
46+
47+
steps:
48+
- name: Checkout repository
49+
uses: actions/checkout@v3
50+
with:
51+
submodules: recursive
52+
53+
# Initializes the CodeQL tools for scanning.
54+
- name: Initialize CodeQL
55+
uses: github/codeql-action/init@v2
56+
with:
57+
languages: ${{ matrix.language }}
58+
# If you wish to specify custom queries, you can do so here or in a config file.
59+
# By default, queries listed here will override any specified in a config file.
60+
# Prefix the list here with "+" to use these queries and those in the config file.
61+
62+
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
63+
# queries: security-extended,security-and-quality
64+
65+
66+
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
67+
# If this step fails, then you should remove it and run the build manually (see below)
68+
- name: Autobuild
69+
uses: github/codeql-action/autobuild@v2
70+
with:
71+
working-directory: ${{ github.workspace }}/src/Typewriter
72+
73+
# ℹ️ Command-line programs to run using the OS shell.
74+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
75+
76+
# If the Autobuild fails above, remove it and uncomment the following three lines.
77+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
78+
79+
# - run: |
80+
# echo "Run, Build Application using script"
81+
# ./location_of_script_within_repo/buildscript.sh
82+
83+
- name: Perform CodeQL Analysis
84+
uses: github/codeql-action/analyze@v2
85+
with:
86+
category: "/language:${{matrix.language}}"

0 commit comments

Comments
 (0)