Skip to content

API-42927-veteran-rep-service-standardization #25804

API-42927-veteran-rep-service-standardization

API-42927-veteran-rep-service-standardization #25804

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/[email protected]
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@24bffb9b452ba05a4f3f77933840a6a841d1b32b # v3.0.1
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 }}
- name: Add Failure label
uses: actions-ecosystem/action-add-labels@v1
if: ${{ failure() }}
with:
number: ${{ github.event.pull_request.number }}
labels: |
codeowners-addition-failure
- name: Remove Failure label
uses: actions-ecosystem/action-remove-labels@v1
if: ${{ success() }}
with:
number: ${{ github.event.pull_request.number }}
labels: |
codeowners-addition-failure
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/[email protected]
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@24bffb9b452ba05a4f3f77933840a6a841d1b32b # v3.0.1
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 }}
- name: Add Failure label
uses: actions-ecosystem/action-add-labels@v1
if: ${{ failure() }}
with:
number: ${{ github.event.pull_request.number }}
labels: |
codeowners-delete-failure
- name: Remove Failure label
uses: actions-ecosystem/action-remove-labels@v1
if: ${{ success() }}
with:
number: ${{ github.event.pull_request.number }}
labels: |
codeowners-delete-failure