Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.

Commit 16b38c0

Browse files
chore: update branch protection rules, issue management workflow, codeql (#355)
1 parent c11e0cd commit 16b38c0

File tree

3 files changed

+241
-2
lines changed

3 files changed

+241
-2
lines changed

.github/policies/msgraph-cli-branch-protection.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,16 @@ 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
- license/cla
3939
- Microsoft Graph CLI - Release
40+
- CodeQL
4041
# Require branches to be up to date before merging. Requires requiredStatusChecks. boolean
41-
requiresStrictStatusChecks: false
42+
requiresStrictStatusChecks: true
4243
# Indicates whether there are restrictions on who can push. boolean. Should be set with whoCanPush.
4344
restrictsPushes: false
4445
# Restrict who can dismiss pull request reviews. boolean
Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
id:
2+
name: GitOps.PullRequestIssueManagement
3+
description: GitOps.PullRequestIssueManagement primitive
4+
owner:
5+
resource: repository
6+
disabled: false
7+
where:
8+
configuration:
9+
resourceManagementConfiguration:
10+
scheduledSearches:
11+
- description:
12+
frequencies:
13+
- hourly:
14+
hour: 1
15+
filters:
16+
- isIssue
17+
- isOpen
18+
- hasLabel:
19+
label: 'Needs: Author Feedback'
20+
- hasLabel:
21+
label: 'Status: No Recent Activity'
22+
- noActivitySince:
23+
days: 3
24+
- isNotLabeledWith:
25+
label: Service Bug
26+
actions:
27+
- closeIssue
28+
- description:
29+
frequencies:
30+
- hourly:
31+
hour: 1
32+
filters:
33+
- isIssue
34+
- isOpen
35+
- hasLabel:
36+
label: 'Needs: Author Feedback'
37+
- noActivitySince:
38+
days: 4
39+
- isNotLabeledWith:
40+
label: 'Status: No Recent Activity'
41+
- isNotLabeledWith:
42+
label: Service Bug
43+
actions:
44+
- addLabel:
45+
label: 'Status: No Recent Activity'
46+
- addReply:
47+
reply: This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for **4 days**. It will be closed if no further activity occurs **within 3 days of this comment**.
48+
- description:
49+
frequencies:
50+
- hourly:
51+
hour: 1
52+
filters:
53+
- isIssue
54+
- isOpen
55+
- hasLabel:
56+
label: duplicate
57+
- noActivitySince:
58+
days: 1
59+
actions:
60+
- addReply:
61+
reply: This issue has been marked as duplicate and has not had any activity for **1 day**. It will be closed for housekeeping purposes.
62+
- closeIssue
63+
- description:
64+
frequencies:
65+
- hourly:
66+
hour: 1
67+
filters:
68+
- isOpen
69+
- hasLabel:
70+
label: 'API: Graph'
71+
- noActivitySince:
72+
days: 14
73+
actions:
74+
- addLabel:
75+
label: Service issue
76+
- addReply:
77+
reply: >-
78+
Hello @${issueAuthor}
79+
80+
81+
Thank you for reporting your concern. If you report this issue in the Microsoft Q&A forum, it will get routed to the appropriate team for them to triage.
82+
83+
84+
https://aka.ms/askgraph
85+
eventResponderTasks:
86+
- if:
87+
- payloadType: Issues
88+
- and:
89+
- isOpen
90+
- not:
91+
and:
92+
- isAssignedToSomeone
93+
- isLabeled
94+
then:
95+
- addLabel:
96+
label: 'ToTriage'
97+
- if:
98+
- payloadType: Issue_Comment
99+
- isAction:
100+
action: Created
101+
- isActivitySender:
102+
issueAuthor: True
103+
- hasLabel:
104+
label: 'Needs: Author Feedback'
105+
then:
106+
- addLabel:
107+
label: "Needs: Attention \U0001F44B"
108+
- removeLabel:
109+
label: 'Needs: Author Feedback'
110+
description:
111+
- if:
112+
- payloadType: Issues
113+
- not:
114+
isAction:
115+
action: Closed
116+
- hasLabel:
117+
label: 'Status: No Recent Activity'
118+
then:
119+
- removeLabel:
120+
label: 'Status: No Recent Activity'
121+
description:
122+
- if:
123+
- payloadType: Issue_Comment
124+
- activitySenderHasAssociation:
125+
association: Contributor
126+
- bodyContains:
127+
pattern: '?'
128+
isRegex: False
129+
- bodyContains:
130+
pattern: '@'
131+
isRegex: False
132+
then:
133+
- addLabel:
134+
label: 'Needs: Author Feedback'
135+
description:
136+
- if:
137+
- payloadType: Issue_Comment
138+
- hasLabel:
139+
label: 'API: Graph'
140+
then:
141+
- addReply:
142+
reply: >-
143+
Hello @${issueAuthor}
144+
145+
146+
Thank you for reporting your concern. If you report this issue in the Microsoft Q&A forum, it will get routed to the appropriate team for them to triage.
147+
148+
https://aka.ms/askgraph
149+
150+
This issue will now be closed. If you encounter any issues in the future, please feel free to open an issue.
151+
- addLabel:
152+
label: Service issue
153+
- closeIssue
154+
description:
155+
onFailure:
156+
onSuccess:

.github/workflows/codeql.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
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: [ "main" ]
17+
pull_request:
18+
# The branches below must be a subset of the branches above
19+
branches: [ "main" ]
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+
51+
# Initializes the CodeQL tools for scanning.
52+
- name: Initialize CodeQL
53+
uses: github/codeql-action/init@v2
54+
with:
55+
languages: ${{ matrix.language }}
56+
# If you wish to specify custom queries, you can do so here or in a config file.
57+
# By default, queries listed here will override any specified in a config file.
58+
# Prefix the list here with "+" to use these queries and those in the config file.
59+
60+
# 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
61+
# queries: security-extended,security-and-quality
62+
63+
64+
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
65+
# If this step fails, then you should remove it and run the build manually (see below)
66+
- name: Autobuild
67+
uses: github/codeql-action/autobuild@v2
68+
69+
# ℹ️ Command-line programs to run using the OS shell.
70+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
71+
72+
# If the Autobuild fails above, remove it and uncomment the following three lines.
73+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
74+
75+
# - run: |
76+
# echo "Run, Build Application using script"
77+
# ./location_of_script_within_repo/buildscript.sh
78+
79+
- name: Perform CodeQL Analysis
80+
uses: github/codeql-action/analyze@v2
81+
with:
82+
category: "/language:${{matrix.language}}"

0 commit comments

Comments
 (0)