mszostok/codeowners-validator

Support user repositories which are not under organization

Opened this issue · 2 comments

remal commented

I'm trying to use codeowners-validator for my own repository, which is not owned by an organisation, with default settings like this:

name: 'Codeowners validation'

on:
  push:
    paths:
    - '.github/CODEOWNERS'
    - '.github/workflows/codeowners-validator.yml'
    branches:
    - '**'
    tags-ignore:
    - '**'
  schedule:
  - cron: '37 4 * * *'
  workflow_dispatch: { }

jobs:
  codeowners-validation:
    runs-on: ubuntu-latest
    timeout-minutes: 15
    steps:
    - name: Checkout repository
      uses: actions/checkout@v2
      with:
        fetch-depth: 1

    - name: CODEOWNERS validation
      uses: mszostok/codeowners-validator@v0.6.0
      with:
        github_access_token: '${{ github.token }}'

Expected result

The validation is performed successfully.

Actual result

The validation fails with this error:

==> Executing Valid Owner Checker (64.079355ms)
    [err] line 1: Cannot initialize organization member list: GET https://api.github.com/orgs/remal/members?per_page=100: 404 Not Found []

Hi @remal

Unfortunately, the Codeowners Validator works properly in repos which are under organization. For now, you can disable the owners checker. Example:

name: 'Codeowners validation'

on:
  push:
    paths:
    - '.github/CODEOWNERS'
    - '.github/workflows/codeowners-validator.yml'
    branches:
    - '**'
    tags-ignore:
    - '**'
  schedule:
  - cron: '37 4 * * *'
  workflow_dispatch: { }

jobs:
  codeowners-validation:
    runs-on: ubuntu-latest
    timeout-minutes: 15
    steps:
    - name: Checkout repository
      uses: actions/checkout@v2
      with:
        fetch-depth: 1

      - name: GitHub CODEOWNERS Validator
        uses: mszostok/codeowners-validator@v0.6.0
        with:
          checks: "files,duppatterns,syntax" # `owners` is not mentioned here so it is disabled
          experimental_checks: "notowned"
          # GitHub access token is required only if the `owners` check is enabled
          github_access_token: "${{ secrets.OWNERS_VALIDATOR_GITHUB_SECRET }}"

With that you still can benefit from other checkers :)

remal commented

@mszostok I've already done it, but I suggest implementing a check if repo owner is an organisation.