Fix/make sure start date before end date #66712
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Check CODEOWNERS Entries | |
| on: | |
| pull_request: | |
| branches: | |
| - master | |
| types: | |
| - opened | |
| - synchronize | |
| - reopened | |
| - edited | |
| permissions: | |
| id-token: write | |
| contents: read | |
| jobs: | |
| check-additions: | |
| name: Check Codeowners Additions | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| with: | |
| fetch-depth: 2 | |
| - name: Configure AWS Credentials | |
| uses: aws-actions/configure-aws-credentials@8df5847569e6427dd6c4fb1cf565c83acfa8afa7 # v6 | |
| with: | |
| role-to-assume: ${{ vars.AWS_ASSUME_ROLE }} | |
| aws-region: "us-gov-west-1" | |
| - name: Get GitHub Bot Token | |
| uses: marvinpinto/action-inject-ssm-secrets@3bb59520768371a76609c11678e23c2c911899d9 # v1.2.1 | |
| 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: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 | |
| with: | |
| github-token: ${{ env.VA_VSP_BOT_GITHUB_TOKEN }} | |
| script: | | |
| const prNumber = context.payload.pull_request.number | |
| const offendingFile = process.env.offending_file | |
| const body = `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: ${offendingFile}` | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: prNumber, | |
| body, | |
| }) | |
| - name: Add Failure label | |
| if: ${{ failure() }} | |
| uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 | |
| with: | |
| github-token: ${{ env.VA_VSP_BOT_GITHUB_TOKEN }} | |
| script: | | |
| const prNumber = context.payload.pull_request.number | |
| await github.rest.issues.addLabels({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: prNumber, | |
| labels: ['codeowners-addition-failure'], | |
| }) | |
| - name: Remove Failure label | |
| if: ${{ success() }} | |
| uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 | |
| with: | |
| github-token: ${{ env.VA_VSP_BOT_GITHUB_TOKEN }} | |
| script: | | |
| const prNumber = context.payload.pull_request.number | |
| try { | |
| await github.rest.issues.removeLabel({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: prNumber, | |
| name: 'codeowners-addition-failure', | |
| }) | |
| } catch (e) { | |
| if (e.status !== 404) throw e | |
| } | |
| check-deletions: | |
| name: Check Codeowners Deletions | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| with: | |
| fetch-depth: 2 | |
| - name: Configure AWS Credentials | |
| uses: aws-actions/configure-aws-credentials@8df5847569e6427dd6c4fb1cf565c83acfa8afa7 # v6 | |
| with: | |
| role-to-assume: ${{ vars.AWS_ASSUME_ROLE }} | |
| aws-region: "us-gov-west-1" | |
| - name: Get GitHub Bot Token | |
| uses: marvinpinto/action-inject-ssm-secrets@3bb59520768371a76609c11678e23c2c911899d9 # 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: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 | |
| with: | |
| github-token: ${{ env.VA_VSP_BOT_GITHUB_TOKEN }} | |
| script: | | |
| const prNumber = context.payload.pull_request.number | |
| const offendingFile = process.env.offending_file | |
| const body = `A deleted file (or one of its parent directories) still has a CODEOWNERS entry. Please update the .github/CODEOWNERS file and remove the stale entry for the offending file: ${offendingFile}` | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: prNumber, | |
| body, | |
| }) | |
| - name: Add Failure label | |
| if: ${{ failure() }} | |
| uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 | |
| with: | |
| github-token: ${{ env.VA_VSP_BOT_GITHUB_TOKEN }} | |
| script: | | |
| const prNumber = context.payload.pull_request.number | |
| await github.rest.issues.addLabels({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: prNumber, | |
| labels: ['codeowners-deletion-failure'], | |
| }) | |
| - name: Remove Failure label | |
| if: ${{ success() }} | |
| uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 | |
| with: | |
| github-token: ${{ env.VA_VSP_BOT_GITHUB_TOKEN }} | |
| script: | | |
| const prNumber = context.payload.pull_request.number | |
| try { | |
| await github.rest.issues.removeLabel({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: prNumber, | |
| name: 'codeowners-deletion-failure', | |
| }) | |
| } catch (e) { | |
| if (e.status !== 404) throw e | |
| } |