EkLine GitHub Integration Guide
This guide walks you through using the EkLine GitHub Action for automated documentation review in your GitHub repositories.
Prerequisites
Section titled “Prerequisites”Before you begin, ensure you have the following:
- An EkLine integration token. You can obtain this by visiting the EkLine dashboard and clicking on the View Integration Token button.
Create a new GitHub Actions workflow
Section titled “Create a new GitHub Actions workflow”In your GitHub repository, navigate to the “Actions” tab. Click “New workflow” and choose the “set up a workflow yourself” option.
In the new workflow file, you can name it ekline.yml. GitHub stores this file in the .github/workflows/ directory in your repository.
Configure the EkLine GitHub action
Section titled “Configure the EkLine GitHub action”Copy and paste the following template into your workflow file:
name: EkLineon: push: branches: - master - main pull_request:jobs: test-pr-review: if: github.event_name == 'pull_request' name: runner / EkLine Reviewer (github-pr-review) runs-on: ubuntu-latest permissions: contents: read pull-requests: write steps: - uses: actions/checkout@v3 - uses: ekline-io/ekline-github-action@v6 with: content_dir: ./src/docs ek_token: ${{ secrets.ek_token }} github_token: ${{ secrets.github_token }} reporter: github-pr-review filter_mode: added # ignore_rule: "EK00001,EK00004" # Optional # exclude-directories: "node_modules,tests" # Optional # exclude-files: "README.md,CONTRIBUTING.md" # Optional # style-guide: "./.ekline-style-guide.yml" # OptionalConfiguration options
Section titled “Configuration options”Below are all available configuration options for the EkLine GitHub Action:
| Option | Description | Format or Allowed Values | Default |
|---|---|---|---|
content_dir | The content directory relative to the root directory. | String, which is a relative path. | . |
ek_token | The EkLine integration token. | String | — |
github_token | The GITHUB_TOKEN, allows commenting and status updates. | String, secret or ${{ secrets.github_token }} | ${{ secrets.github_token }} |
reporter | How EkLine reports results. [github-pr-check, github-check, github-pr-review] | String | github-pr-check |
filter_mode | Filtering mode for results. [added, diff_context, file, nofilter] | String | added |
ignore_rule | Comma-separated list of rule identifiers to ignore. | String, for example, “EK00001,EK00004” | — |
exclude-directories | Comma-separated list of directories relative to content_dir to exclude from review. | String for example, “node_modules,tests” | — |
exclude-files | Comma-separated list of files relative to content_dir to exclude from review. | String, for example, “README.md, CONTRIBUTING.md” | — |
style-guide | Path to a custom style guide file, relative to repository root or content_dir. | String, for example, "./.ekline-style-guide.yml" | — |
Filter modes
Section titled “Filter modes”You can control how the EkLine reviewer filters results by specifying the filter_mode option. Available filter modes are as below:
- added default: Filter results by added or modified lines.
diff_context: Filter results by diff context. For example, changed lines plus or minus N lines, where N could be 3.file: Filter results by added or modified file. EkLine reviewer reports results as long as they’re in an added or modified file, even if the results aren’t in the actual diff.nofilter: Don’t filter any results. Useful for posting results as comments as much as possible and checking other results in the console simultaneously.
Reporter types
Section titled “Reporter types”github-pr-check: Reports results to GitHub Checks.github-check: Similar togithub-pr-check, but works for both pull requests and commits.github-pr-review: Reports results to GitHub PullRequest review comments using a GitHub Personal API Access Token.
Ignoring specific rules
Section titled “Ignoring specific rules”To ignore specific rules during the review process, you can use the ignore_rule flag. This flag accepts a comma-separated list of rule identifiers that you wish to skip.
For example, if you want to ignore rules EK00001 and EK00004, you can set the ignore_rule flag in your configuration like this:
ignore_rule: "EK00001,EK00004"Save and commit the workflow file
Section titled “Save and commit the workflow file”After configuring the workflow file, click “Start commit” to save and commit the file to your repository. The EkLine GitHub Action runs automatically when you push changes to the master or main branches or create a pull request.
Add the EkLine integration token to your repository secrets
Section titled “Add the EkLine integration token to your repository secrets”
Grant write permissions to workflows
Section titled “Grant write permissions to workflows”To enable the EkLine GitHub Action to add comments to pull requests, you must grant write permissions to workflows. There are two ways to achieve this:
Option 1: Through repository settings
Section titled “Option 1: Through repository settings”- Navigate to Settings > Code and Automation > Actions > General > Workflow permissions.
- Click the drop-down menu and select Read and write permissions.
- Click Save to apply the changes.
Option 2: Through the workflow file
Section titled “Option 2: Through the workflow file”Add the following permissions block to your workflow file:
permissions: contents: read pull-requests: writeCheck the EkLine GitHub Action results
Section titled “Check the EkLine GitHub Action results”Once the EkLine GitHub Action runs, you can view the results in the “Actions” tab of your repository.
Now, you have integrated the EkLine GitHub Action into your repository for automated documentation review. Enjoy better quality and consistency in your documentation.