From f0934087df2522be97379582e2bcca5ec471fff0 Mon Sep 17 00:00:00 2001 From: Lindsey Hattamer Date: Wed, 13 Sep 2023 13:49:02 -0400 Subject: [PATCH] Split CODEOWNERS GHA into separate jobs (#13813) * split into separate jobs * test addition check * This should pass * this should also pass * This too shall pass * test the delete scenario and bot message * test passed placing back --- .github/workflows/check_codeowners.yml | 39 ++++++++++++++++++++------ 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/.github/workflows/check_codeowners.yml b/.github/workflows/check_codeowners.yml index 99c5991cb66..28c5258feb0 100644 --- a/.github/workflows/check_codeowners.yml +++ b/.github/workflows/check_codeowners.yml @@ -10,8 +10,8 @@ on: - reopened jobs: - check: - name: Check Codeowners + check-additions: + name: Check Codeowners Additions runs-on: ubuntu-latest steps: @@ -46,15 +46,38 @@ jobs: 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@v3 + with: + fetch-depth: 2 + + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v1-node16 + 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/action-inject-ssm-secrets@v1.2.1 + 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@dadb7667129e23f12ca3925c90dc5cd7121ab57e # v2.4.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 }} + - name: Respond to PR if check CODEOWNERS exists for deleted files fails + if: ${{ failure() }} + uses: thollander/actions-comment-pull-request@dadb7667129e23f12ca3925c90dc5cd7121ab57e # v2.4.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 }}