Skip to content

Commit c618d62

Browse files
authored
Adds branch policy (#1401)
* Adds branch policy * Adds build check
1 parent 5094565 commit c618d62

File tree

2 files changed

+56
-1
lines changed

2 files changed

+56
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
3+
4+
name: kiota-typescript-branch-protection
5+
description: Branch protection policy for the kiota-typescript repository
6+
resource: repository
7+
configuration:
8+
branchProtectionRules:
9+
10+
- branchNamePattern: main
11+
# This branch pattern applies to the following branches as of 06/09/2023 14:08:44:
12+
# dev
13+
14+
# Specifies whether this branch can be deleted. boolean
15+
allowsDeletions: false
16+
# Specifies whether forced pushes are allowed on this branch. boolean
17+
allowsForcePushes: false
18+
# Specifies whether new commits pushed to the matching branches dismiss pull request review approvals. boolean
19+
dismissStaleReviews: true
20+
# Specifies whether admins can overwrite branch protection. boolean
21+
isAdminEnforced: false
22+
# Indicates whether "Require a pull request before merging" is enabled. boolean
23+
requiresPullRequestBeforeMerging: true
24+
# Specifies the number of pull request reviews before merging. int (0-6). Should be null/empty if PRs are not required
25+
requiredApprovingReviewsCount: 1
26+
# Require review from Code Owners. Requires requiredApprovingReviewsCount. boolean
27+
requireCodeOwnersReview: true
28+
# Are commits required to be signed. boolean. TODO: all contributors must have commit signing on local machines.
29+
requiresCommitSignatures: false
30+
# Are conversations required to be resolved before merging? boolean
31+
requiresConversationResolution: true
32+
# Are merge commits prohibited from being pushed to this branch. boolean
33+
requiresLinearHistory: false
34+
# 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
35+
requiredStatusChecks:
36+
- license/cla
37+
- check-typescript-version-matrix
38+
# Require branches to be up to date before merging. This should be false since the repo contains autogenerated files. boolean
39+
requiresStrictStatusChecks: false
40+
# Indicates whether there are restrictions on who can push. boolean. Should be set with whoCanPush.
41+
restrictsPushes: false
42+
# Restrict who can dismiss pull request reviews. boolean
43+
restrictsReviewDismissals: false

.github/workflows/build_test_validate.yml

+13-1
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,16 @@ jobs:
7171
env:
7272
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
7373

74-
74+
# The check-typescript-version-matrix returns success if all matrix jobs in build are successful; otherwise, it returns a failure.
75+
# Use this as a PR status check for GitHub Policy Service instead of individual matrix entry checks.
76+
check-typescript-version-matrix:
77+
runs-on: ubuntu-latest
78+
needs: [build]
79+
if: always()
80+
steps:
81+
- name: All build matrix options are successful
82+
if: ${{ !(contains(needs.*.result, 'failure')) }}
83+
run: exit 0
84+
- name: One or more build matrix options failed
85+
if: ${{ contains(needs.*.result, 'failure') }}
86+
run: exit 1

0 commit comments

Comments
 (0)