Skip to content

Commit

Permalink
Updated README and fixed script output
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaurav Nelson committed Aug 25, 2019
1 parent 9b9cd51 commit 1d750f3
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 26 deletions.
48 changes: 26 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,32 @@ The `github-action-vale-lint` checks all modified text (including markup) files
## Prerequisite
You must have [Vale configuration file](https://errata-ai.github.io/vale/config/) `.vale.ini` in your repository.

## Workflow file
Sample workflow file `pull_request.yml`:

![Lint with Vale on PR](https://raw.githubusercontent.com/gaurav-nelson/github-action-vale-lint/master/images/lint-with-vale-on-pr.png)

```
on: pull_request
name: Lint with vale on PR
jobs:
vale-lint-PR:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: vale-lint-PR
uses: ./
env:
GH_COMMENT_TOKEN: ${{ secrets.GH_COMMENT_TOKEN }}
```

## Add Vale errors as comments on PR

In your repository:
## How to use
1. Create a new file in your repository `.github/workflows/action.yml`.
```bash
touch .github/workflows/action.yml
```
1. Copy-paste the folloing workflow in your `action.yml` file:

```yml
name: Lint PRs with Vale

on: pull_request

jobs:
vale-lint-PR:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
with:
fetch-depth: 1
- uses: gaurav-nelson/github-action-vale-lint@v0.0.2-alpha
env:
GH_COMMENT_TOKEN: ${{ secrets.GH_COMMENT_TOKEN }}
```
### Add Vale errors as comments on PR
If you want to show errors as comments on the pull request, in your repository:
1. Go to **Settings** > **Secrets**, and slect **Add a new secret**.
1. Enter **GH_COMMENT_TOKEN** for **Name**, and enter your secret token as
**Value**.
Expand Down
8 changes: 4 additions & 4 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ if [ -s output.txt ] ; then
echo ""
fi
if [[ -z "${GH_COMMENT_TOKEN}" ]]; then
echo -e "${BLUE}NOTE: If you want to add these errors as a comment on the original pull request, add a GH_COMMENT_TOKEN as an environment variable.${NC}"
echo -e "${BLUE}To add a new Secret, go to Repository Settings > Secrets > Add a new secret${NC}"
echo -e "${YELLOW}NOTE: If you want to add errors as a comment on the original pull request, add a GH_COMMENT_TOKEN as a Secret."
echo -e "To add a new Secret, go to ${BLUE}Repository Settings > Secrets > Add a new secret${NC}"
else
NO_ERROR="0 errors, 0 warnings and 0 suggestions"
if grep -qF "$NO_ERROR" output.txt
Expand All @@ -124,8 +124,8 @@ if [ -s output.txt ] ; then
exit 113
else
if [[ -z "${GH_COMMENT_TOKEN}" ]]; then
echo -e "${BLUE}NOTE: If you want to add these errors as a comment on the original pull request, add a GH_COMMENT_TOKEN as an environment variable.${NC}"
echo -e "${BLUE}To add a new Secret, go to Repository Settings > Secrets > Add a new secret${NC}"
echo -e "${YELLOW}NOTE: If you want to add errors as a comment on the original pull request, add a GH_COMMENT_TOKEN as a Secret."
echo -e "To add a new Secret, go to ${BLUE}Repository Settings > Secrets > Add a new secret${NC}"
echo -e "${GREEN}All good!${NC}"
else
check_events_json;
Expand Down
Binary file modified images/lint-with-vale.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/vale-error-list.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 1d750f3

Please sign in to comment.