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.
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.
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 }}
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!
-
🛠️ Install the dependencies
npm install
-
🏗️ Package the TypeScript for distribution
npm run bundle
-
✅ Run the tests
$ npm test PASS ./index.test.js ✓ throws invalid number (3ms) ✓ wait 500 ms (504ms) ✓ test runs (95ms) ...