-
Notifications
You must be signed in to change notification settings - Fork 9
125 lines (118 loc) · 5 KB
/
CheckCodeOwnerMaintainers.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
## @file
# Check CODEOWNERS, REVIEWERS, and Maintainers.txt files.
#
# Only run this check if any of the files modified in the PR
# are CODEOWNERS, REVIEWERS, or Maintainers.txt.
#
# This workflow uses pull_request_target to support passing in
# github_access_token that is not available for pull_request.
# The checkout action checks out the head of the PR. In this
# specific workflow, this is safe because there are no dependencies
# on any files other that this .yml file and known external actions.
#
# Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent
##
name: Check CODEOWNERS, REVIEWERS, and Maintainers.txt files
on:
pull_request_target:
types: [opened, synchronize, reopened, ready_for_review]
branches:
- 'master'
paths:
- 'CODEOWNERS'
- 'docs/CODEOWNERS'
- '.github/CODEOWNERS'
- 'REVIEWERS'
- 'docs/REVIEWERS'
- '.github/REVIEWERS'
- 'Maintainers.txt'
jobs:
check_codeowners_maintainers:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- name: Checkout Pull Request
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Check CODEOWNERS, REVIEWERS, and Maintainers.txt files
uses: mdkinney/github-action-check-codeowners-maintainers@main
with:
token: ${{secrets.GITHUB_TOKEN}}
codeowners_validator_user:
if: github.event.pull_request.draft == false && github.event.pull_request.base.user.type == 'User'
runs-on: ubuntu-latest
steps:
- name: Checkout Pull Request
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: CODEOWNERS Validator
uses: mszostok/[email protected]
with:
checks: "files,duppatterns,syntax"
experimental_checks: "notowned,avoid-shadowing"
github_access_token: "${{ secrets.GITHUB_TOKEN }}"
codeowners_validator_organization:
if: github.event.pull_request.draft == false && github.event.pull_request.base.user.type == 'Organization'
runs-on: ubuntu-latest
steps:
- name: Checkout Pull Request
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: CODEOWNERS Validator
uses: mszostok/[email protected]
with:
checks: "files,owners,duppatterns,syntax"
experimental_checks: "notowned,avoid-shadowing"
github_app_id: ${{ secrets.APPLICATION_ID }}
github_app_installation_id: ${{ secrets.APPLICATION_INSTALLATION_ID }}
github_app_private_key: ${{ secrets.APPLICATION_PRIVATE_KEY }}
reviewers_validator_user:
if: github.event.pull_request.draft == false && github.event.pull_request.base.user.type == 'User'
runs-on: ubuntu-latest
steps:
- name: Checkout Pull Request
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Copy REVIEWERS to CODEOWNERS
run: |
[[ -e CODEOWNERS ]] && rm CODEOWNERS
[[ -e docs/CODEOWNERS ]] && rm docs/CODEOWNERS
[[ -e .github/CODEOWNERS ]] && rm .github/CODEOWNERS
[[ -e REVIEWERS ]] && cp REVIEWERS CODEOWNERS
[[ -e docs/REVIEWERS ]] && cp docs/REVIEWERS docs/CODEOWNERS
[[ -e .github/REVIEWERS ]] && cp .github/REVIEWERS .github/CODEOWNERS
- name: REVIEWERS Validator
uses: mszostok/[email protected]
with:
checks: "files,duppatterns,syntax"
experimental_checks: "avoid-shadowing"
github_access_token: "${{ secrets.GITHUB_TOKEN }}"
reviewers_validator_organization:
if: github.event.pull_request.draft == false && github.event.pull_request.base.user.type == 'Organization'
runs-on: ubuntu-latest
steps:
- name: Checkout Pull Request
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Copy REVIEWERS to CODEOWNERS
run: |
[[ -e CODEOWNERS ]] && rm CODEOWNERS
[[ -e docs/CODEOWNERS ]] && rm docs/CODEOWNERS
[[ -e .github/CODEOWNERS ]] && rm .github/CODEOWNERS
[[ -e REVIEWERS ]] && cp REVIEWERS CODEOWNERS
[[ -e docs/REVIEWERS ]] && cp docs/REVIEWERS docs/CODEOWNERS
[[ -e .github/REVIEWERS ]] && cp .github/REVIEWERS .github/CODEOWNERS
- name: REVIEWERS Validator
uses: mszostok/[email protected]
with:
checks: "files,owners,duppatterns,syntax"
experimental_checks: "avoid-shadowing"
github_app_id: ${{ secrets.APPLICATION_ID }}
github_app_installation_id: ${{ secrets.APPLICATION_INSTALLATION_ID }}
github_app_private_key: ${{ secrets.APPLICATION_PRIVATE_KEY }}