Skip to content

robmaxwellirl/codeowner-validator

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

Codeowner Validator GitHub Action

Example workflow linting

What is this action for?

This action is to help validate that every file in a repository has an owner defined in the codeowners file. Whilst GitHub can validate that a codeowners file is correct, it does not actually ensure each file has an owner.

This will scan through the repository files, and if any file not found to have an owner, it will alert on it and fail the check.

It will output the files not owned as part of the status check and output them. They should be added to the codeowners file and the check will then pass.

Usage

After testing, you can create version tag(s) that developers can use to reference different stable versions of your action. For more information, see Versioning in the GitHub Actions toolkit.

To include the action in a workflow in another repository, you can use the uses syntax with the @ symbol to reference a specific branch, tag, or commit hash.

Inputs

token: Plan GitHub token used to auth to the repository. codecodeowners-file: location of file if not located at .github/CODEOWNERS

steps:
  - name: Checkout
    id: checkout
    uses: actions/checkout@v4

  - name: Validate files have owners
    uses: robmaxwellirl/codeowner-validator@v1
    with:
      token: ${{ secrets.GITHUB_TOKEN }}

Building and testing locally

After you've cloned the repository to your local machine or codespace, you'll need to perform some initial setup steps before you can develop your action.

Note

You'll need to have a reasonably modern version of Node.js handy. If you are using a version manager like nodenv or nvm, you can run nodenv install in the root of your repository to install the version specified in package.json. Otherwise, 20.x or later should work!

  1. 🛠️ Install the dependencies

    npm install
  2. 🏗️ Package the TypeScript for distribution

    npm run bundle
  3. ✅ Run the tests

    $ npm test
    
    PASS  ./index.test.js
      ✓ throws invalid number (3ms)
      ✓ wait 500 ms (504ms)
      ✓ test runs (95ms)
    
    ...

About

Github action to show any files which are not within the codeowners

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published