Skip to content

Commit

Permalink
Adjust docs and GitHub action for v0.7.0 release (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
mszostok committed Feb 12, 2022
1 parent dcfa851 commit c4754a1
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ RUN apk --no-cache add ca-certificates git

FROM scratch

LABEL source=https://github.com/mszostok/codeowners-validator.git
LABEL org.opencontainers.image.source=https://github.com/mszostok/codeowners-validator

COPY ./codeowners-validator /codeowners-validator

Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ docker run --rm -v $(pwd):/repo -w /repo \
-e GITHUB_ACCESS_TOKEN="$GH_TOKEN" \
-e EXPERIMENTAL_CHECKS="notowned" \
-e OWNER_CHECKER_REPOSITORY="org-name/rep-name" \
mszostok/codeowners-validator:v0.6.0
mszostok/codeowners-validator:v0.7.0
```

#### Command line
Expand All @@ -46,7 +46,7 @@ env REPOSITORY_PATH="." \
#### GitHub Action

```yaml
- uses: mszostok/codeowners-validator@v0.6.0
- uses: mszostok/codeowners-validator@v0.7.0
with:
checks: "files,owners,duppatterns"
experimental_checks: "notowned"
Expand All @@ -70,13 +70,13 @@ Here is the recommended way to install `codeowners-validator`:

```bash
# binary installed into ./bin/
curl -sfL https://raw.githubusercontent.com/mszostok/codeowners-validator/main/install.sh | sh -s v0.6.0
curl -sfL https://raw.githubusercontent.com/mszostok/codeowners-validator/main/install.sh | sh -s v0.7.0

# binary installed into $(go env GOPATH)/bin/codeowners-validator
curl -sfL https://raw.githubusercontent.com/mszostok/codeowners-validator/main/install.sh | sh -s -- -b $(go env GOPATH)/bin v0.6.0
curl -sfL https://raw.githubusercontent.com/mszostok/codeowners-validator/main/install.sh | sh -s -- -b $(go env GOPATH)/bin v0.7.0

# In alpine linux (as it does not come with curl by default)
wget -O - -q https://raw.githubusercontent.com/mszostok/codeowners-validator/main/install.sh | sh -s v0.6.0
wget -O - -q https://raw.githubusercontent.com/mszostok/codeowners-validator/main/install.sh | sh -s v0.7.0

# Print version. Add `--short` to print just the version number.
codeowners-validator -v
Expand All @@ -86,7 +86,7 @@ You can also download [latest version](https://github.com/mszostok/codeowners-va

#### From Sources

You can install `codeowners-validator` with `go install github.com/mszostok/codeowners-validator@v0.6.0`.
You can install `codeowners-validator` with `go install github.com/mszostok/codeowners-validator@v0.7.0`.

> NOTE: please use Go 1.16 or greater.
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ inputs:

runs:
using: 'docker'
image: 'docker://mszostok/codeowners-validator:v0.6.0'
image: 'docker://ghcr.io/mszostok/codeowners-validator:v0.7.0'
env:
ENVS_PREFIX: "INPUT"

Expand Down
23 changes: 13 additions & 10 deletions docs/gh-action.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@

##
The [Codeowners Validator](https://github.com/mszostok/codeowners-validator) is available as a GitHub Action.

<p align="center">
<img src="https://raw.githack.com/mszostok/codeowners-validator/main/docs/assets/action-output.png" width="600px" alt="demo">
</p>


## Usage

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))

```yaml
Expand All @@ -35,7 +35,7 @@ jobs:
# Checks-out your repository, which is validated in the next step
- uses: actions/checkout@v2
- name: GitHub CODEOWNERS Validator
uses: mszostok/codeowners-validator@v0.6.0
uses: mszostok/codeowners-validator@v0.7.0
# input parameters
with:
# "The list of checks that will be executed. By default, all checks are executed. Possible values: files,owners,duppatterns,syntax"
Expand All @@ -46,27 +46,30 @@ jobs:

# GitHub access token is required only if the `owners` check is enabled
github_access_token: "${{ secrets.OWNERS_VALIDATOR_GITHUB_SECRET }}"

# The GitHub base URL for API requests. Defaults to the public GitHub API, but can be set to a domain endpoint to use with GitHub Enterprise.
github_base_url: "https://api.github.com/"

# The GitHub upload URL for uploading files. It is taken into account only when the GITHUB_BASE_URL is also set. If only the GITHUB_BASE_URL is provided then this parameter defaults to the GITHUB_BASE_URL value.
github_upload_url: "https://uploads.github.com/"

# The repository path in which CODEOWNERS file should be validated."
repository_path: "."

# Defines the level on which the application should treat check issues as failures. Defaults to warning, which treats both errors and warnings as failures, and exits with error code 3. Possible values are error and warning. Default: warning"
check_failure_level: "warning"

# The comma-separated list of patterns that should be ignored by not-owned-checker. For example, you can specify * and as a result, the * pattern from the CODEOWNERS file will be ignored and files owned by this pattern will be reported as unowned unless a later specific pattern will match that path. It's useful because often we have default owners entry at the begging of the CODOEWNERS file, e.g. * @global-owner1 @global-owner2"
not_owned_checker_skip_patterns: ""

# The owner and repository name. For example, gh-codeowners/codeowners-samples. Used to check if GitHub team is in the given organization and has permission to the given repository."
owner_checker_repository: "${{ github.repository }}"

# The comma-separated list of owners that should not be validated. Example: @owner1,@owner2,@org/team1,example@email.com."
owner_checker_ignored_owners: "@ghost"

# Specifies whether CODEOWNERS may have unowned files. For example, `/infra/oncall-rotator/oncall-config.yml` doesn't have owner and this is not reported.
owner_checker_allow_unowned_patterns: "true"
```

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.
Expand All @@ -77,6 +80,6 @@ The best is to run this as a cron job and not only if you applying changes to CO

## Configuration

For the GitHub Action, use the configuration described in the main README under the [Configuration](../README.md#configuration) section but **specify it as the [Action input parameters](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepswith) instead of environment variables**. See the [Usage](#usage) section for the full syntax.
For the GitHub Action, use the configuration described in the main README under the [Configuration](../README.md#configuration) section but **specify it as the [Action input parameters](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepswith) instead of environment variables**. See the [Usage](#usage) section for the full syntax.

If you want to use environment variables anyway, you must add the `INPUT_` prefix to each environment variable. For example, `OWNER_CHECKER_IGNORED_OWNERS` becomes `INPUT_OWNER_CHECKER_IGNORED_OWNERS`.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
==> Executing [Experimental] Not Owned File Checker (<duration>)
[err] Found 2 not owned files (skipped patterns: "*"):
[err] Found 3 not owned files (skipped patterns: "*"):
* .gitignore
* CODEOWNERS
* action.yml

1 check(s) executed, 1 failure(s)

0 comments on commit c4754a1

Please sign in to comment.