You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Check [this](./docs/gh-action.md) document for more information about GitHub Action.
55
+
56
+
----
57
+
58
+
Check the [Configuration](#configuration) section for more info on how to enable and configure given checks.
59
+
18
60
## Installation
19
61
20
62
It's highly recommended to install a fixed version of `codeowners-validator`. Releases are available on the [releases page](https://github.com/mszostok/codeowners-validator/releases).
@@ -47,38 +89,6 @@ You can install `codeowners-validator` with `env GO111MODULE=on go get -u github
47
89
48
90
This will put `codeowners-validator` in `$(go env GOPATH)/bin`
49
91
50
-
## Usage
51
-
52
-
#### Docker
53
-
54
-
```bash
55
-
export GH_TOKEN=<your_token>
56
-
docker run --rm -v $(pwd):/repo -w /repo \
57
-
-e REPOSITORY_PATH="." \
58
-
-e GITHUB_ACCESS_TOKEN="$GH_TOKEN" \
59
-
-e EXPERIMENTAL_CHECKS="notowned" \
60
-
-e OWNER_CHECKER_REPOSITORY="org-name/rep-name" \
61
-
mszostok/codeowners-validator:v0.4.0
62
-
```
63
-
64
-
#### Command line
65
-
66
-
```bash
67
-
export GH_TOKEN=<your_token>
68
-
env REPOSITORY_PATH="." \
69
-
GITHUB_ACCESS_TOKEN="$GH_TOKEN" \
70
-
EXPERIMENTAL_CHECKS="notowned" \
71
-
OWNER_CHECKER_REPOSITORY="org-name/rep-name" \
72
-
codeowners-validator
73
-
```
74
-
75
-
#### GitHub Action
76
-
77
-
Coming soon 😎 Stay tuned!
78
-
79
-
80
-
Check the [Configuration](#configuration) section for more info on how to enable and configure given checks.
81
-
82
92
## Configuration
83
93
84
94
Use the following environment variables to configure the application:
description: "The GitHub access token. Instruction for creating a token can be found here. If not provided then validating owners functionality could not work properly, e.g. you can reach the API calls quota or if you are setting GitHub Enterprise base URL then an unauthorized error can occur."
7
+
description: "The GitHub access token. Instruction for creating a token can be found here: https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/#creating-a-token. If not provided then validating owners functionality could not work properly, e.g. you can reach the API calls quota or if you are setting GitHub Enterprise base URL then an unauthorized error can occur."
Create a workflow (eg: `.github/workflows/sanity.yml` see [Creating a Workflow file](https://help.github.com/en/articles/configuring-a-workflow#creating-a-workflow-file))
21
+
22
+
```yaml
23
+
name: "Codeowners Validator"
24
+
25
+
on:
26
+
schedule:
27
+
# Runs at 08:00 UTC every day
28
+
- cron: '0 8 * * *'
29
+
30
+
jobs:
31
+
sanity:
32
+
runs-on: ubuntu-latest
33
+
steps:
34
+
# Checks-out your repository, which is validated in the next step
35
+
- uses: actions/checkout@v2
36
+
- name: GitHub CODEOWNERS Validator
37
+
uses: mszostok/codeowners-validator@v0.4.0
38
+
with:
39
+
checks: "files,owners,duppatterns"
40
+
experimental_checks: "notowned"
41
+
# GitHub access token is required only if the `owners` check is enabled
The best is to run this as a cron job and not only if you applying changes to CODEOWNERS file itself, e.g. the CODEOWNERS file can be invalidate when you removing someone from the organization.
46
+
47
+
> **Note**: To execute `owners` check you need to create a [GitHub token](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/#creating-a-token) and store it as a secret in your repository, see ["Creating and storing encrypted secrets."](https://help.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets). Token requires only read-only scope for your repository.
0 commit comments