-
Notifications
You must be signed in to change notification settings - Fork 66
83 lines (70 loc) · 2.79 KB
/
check_codeowners.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
name: Check CODEOWNERS Entries
on:
pull_request:
branches:
- '*'
types:
- opened
- synchronize
- reopened
jobs:
check-additions:
name: Check Codeowners Additions
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.aws_access_key_id }}
aws-secret-access-key: ${{ secrets.aws_secret_access_key }}
aws-region: "us-gov-west-1"
- name: Get GitHub Bot Token
uses: marvinpinto/[email protected]
with:
ssm_parameter: /devops/VA_VSP_BOT_GITHUB_TOKEN
env_variable_name: VA_VSP_BOT_GITHUB_TOKEN
- name: Check CODEOWNERS exists for new files
id: check_codeowners
run: |
chmod +x .github/scripts/check_codeowners.sh
.github/scripts/check_codeowners.sh
- name: Respond to PR if check CODEOWNERS exists for new files fails
if: ${{ failure() }}
uses: thollander/actions-comment-pull-request@fabd468d3a1a0b97feee5f6b9e499eab0dd903f6 # v2.5.0
with:
message: 'Error: A file (or its parent directories) does not have a CODEOWNERS entry. Please update the .github/CODEOWNERS file and add the entry for the Offending file: ${{ env.offending_file }}'
GITHUB_TOKEN: ${{ env.VA_VSP_BOT_GITHUB_TOKEN }}
check-deletions:
name: Check Codeowners Deletions
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.aws_access_key_id }}
aws-secret-access-key: ${{ secrets.aws_secret_access_key }}
aws-region: "us-gov-west-1"
- name: Get GitHub Bot Token
uses: marvinpinto/[email protected]
with:
ssm_parameter: /devops/VA_VSP_BOT_GITHUB_TOKEN
env_variable_name: VA_VSP_BOT_GITHUB_TOKEN
- name: Check CODEOWNERS for removal when files deleted
id: check_deleted_files
run: |
chmod +x .github/scripts/check_deleted_files.sh
.github/scripts/check_deleted_files.sh
- name: Respond to PR if check CODEOWNERS exists for deleted files fails
if: ${{ failure() }}
uses: thollander/actions-comment-pull-request@fabd468d3a1a0b97feee5f6b9e499eab0dd903f6 # v2.5.0
with:
message: 'Error: A file (or its parent directories) was deleted but its reference still exists in CODEOWNERS. Please update the .github/CODEOWNERS file and delete the entry for the Offending file: ${{ env.offending_file }}'
GITHUB_TOKEN: ${{ env.VA_VSP_BOT_GITHUB_TOKEN }}