From 167c78a1fbd914106d788431df50af5d83541105 Mon Sep 17 00:00:00 2001 From: Nuru Date: Wed, 9 Dec 2020 20:58:44 -0800 Subject: [PATCH] add validate-codeowners --- .github/workflows/chatops.yml | 4 ++-- .github/workflows/validate-codeowners.yml | 18 ++++++++++++++++++ README.md | 5 ++--- docs/targets.md | 5 ++--- .../.github/workflows/validate-codeowners.yml | 5 ++++- 5 files changed, 28 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/validate-codeowners.yml diff --git a/.github/workflows/chatops.yml b/.github/workflows/chatops.yml index 71293dd1..44b35b88 100644 --- a/.github/workflows/chatops.yml +++ b/.github/workflows/chatops.yml @@ -9,7 +9,7 @@ jobs: steps: - uses: actions/checkout@v2 - name: "Handle common commands" - uses: cloudposse/actions/github/slash-command-dispatch@0.16.0 + uses: cloudposse/actions/github/slash-command-dispatch@0.22.0 with: token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }} reaction-token: ${{ secrets.GITHUB_TOKEN }} @@ -24,7 +24,7 @@ jobs: - name: "Checkout commit" uses: actions/checkout@v2 - name: "Run tests" - uses: cloudposse/actions/github/slash-command-dispatch@0.16.0 + uses: cloudposse/actions/github/slash-command-dispatch@0.22.0 with: token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }} reaction-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/validate-codeowners.yml b/.github/workflows/validate-codeowners.yml new file mode 100644 index 00000000..0bc01d7e --- /dev/null +++ b/.github/workflows/validate-codeowners.yml @@ -0,0 +1,18 @@ +name: Validate Codeowners +on: + pull_request: + paths: + - '**/CODEOWNERS' + - '.github/workflows/validate-codeowners.yml' + +jobs: + validate-codeowners: + runs-on: ubuntu-latest + steps: + - name: "Checkout source code at current commit" + uses: actions/checkout@v2 + - uses: mszostok/codeowners-validator@v0.5.0 + with: + checks: "files,syntax,owners,duppatterns" + # GitHub access token is required only if the `owners` check is enabled + github_access_token: "${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}" diff --git a/README.md b/README.md index 5da53f6e..1b40e0dd 100644 --- a/README.md +++ b/README.md @@ -242,10 +242,9 @@ Available targets: terraform/get-plugins Ensure all plugins can be fetched terraform/install Install terraform terraform/lint Lint check Terraform - terraform/remove-upper-bound Rewrite versions.tf to remove upper bound for terraform core version constraint (like this ">= 0.12.0, < 0.14.0") - terraform/rewrite-module-source Rewrite the *.tf files to use registry notation for modules sources + terraform/loosen-constraints and convert "~>" constraints to ">=". terraform/rewrite-required-providers Rewrite versions.tf to update existing configuration to add an explicit source attribute for each provider - terraform/upgrade-modules Upgrade all terraform module sources + terraform/upgrade-modules This target has not been upgraded to handle registry format terraform/validate Basic terraform sanity check travis/docker-login Login into docker hub travis/docker-tag-and-push Tag & Push according Travis environment variables diff --git a/docs/targets.md b/docs/targets.md index 80a55dce..ffa0b810 100644 --- a/docs/targets.md +++ b/docs/targets.md @@ -119,10 +119,9 @@ Available targets: terraform/get-plugins Ensure all plugins can be fetched terraform/install Install terraform terraform/lint Lint check Terraform - terraform/remove-upper-bound Rewrite versions.tf to remove upper bound for terraform core version constraint (like this ">= 0.12.0, < 0.14.0") - terraform/rewrite-module-source Rewrite the *.tf files to use registry notation for modules sources + terraform/loosen-constraints and convert "~>" constraints to ">=". terraform/rewrite-required-providers Rewrite versions.tf to update existing configuration to add an explicit source attribute for each provider - terraform/upgrade-modules Upgrade all terraform module sources + terraform/upgrade-modules This target has not been upgraded to handle registry format terraform/validate Basic terraform sanity check travis/docker-login Login into docker hub travis/docker-tag-and-push Tag & Push according Travis environment variables diff --git a/templates/.github/workflows/validate-codeowners.yml b/templates/.github/workflows/validate-codeowners.yml index 0bc01d7e..ebdc5c03 100644 --- a/templates/.github/workflows/validate-codeowners.yml +++ b/templates/.github/workflows/validate-codeowners.yml @@ -13,6 +13,9 @@ jobs: uses: actions/checkout@v2 - uses: mszostok/codeowners-validator@v0.5.0 with: - checks: "files,syntax,owners,duppatterns" + # For now, remove "files" check to allow CODEOWNERS to specify non-existent + # files so we can use the same CODEOWNERS file for Terraform and non-Terraform repos + # checks: "files,syntax,owners,duppatterns" + checks: "syntax,owners,duppatterns" # GitHub access token is required only if the `owners` check is enabled github_access_token: "${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}"