Skip to content

Issue 74810

Issue 74810 #11653

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 }}