Skip to content

Commit

Permalink
Merge pull request #68 from themr0c/docs-ci
Browse files Browse the repository at this point in the history
  • Loading branch information
themr0c authored Oct 25, 2021
2 parents f141af4 + 17e9a68 commit d0b81de
Show file tree
Hide file tree
Showing 9 changed files with 79 additions and 9 deletions.
1 change: 1 addition & 0 deletions modules/end-user-guide/examples/download_vale.sh
1 change: 1 addition & 0 deletions modules/end-user-guide/nav.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
* xref:defining-a-vale-onboarding-strategy.adoc[]
* xref:adding-vale-configuration-to-a-project.adoc[]
* xref:creating-a-vocabulary-for-a-project.adoc[]
* xref:using-vale-github-action.adoc[]
* xref:using-vale-with-a-continuous-integration-service.adoc[]
17 changes: 17 additions & 0 deletions modules/end-user-guide/pages/using-vale-github-action.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Metadata for Antora
:navtitle: GitHub Action
:keywords: vale, github
// :page-aliases:
// End of metadata for Antora

:parent-context-of-using-vale-github-action: {context}

[id="using-vale-github-action_{context}"]
= Using vale GitHub Action

:context: using-vale-github-action

include::partial$proc_using-vale-github-action.adoc[leveloffset=+1]


:context: {parent-context-of-using-vale-github-action}
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

:context: using-vale-with-a-continuous-integration-service

include::partial$proc_using-vale-github-action.adoc[leveloffset=+1]

include::partial$proc_using-vale-with-a-continuous-integration-service.adoc[leveloffset=+1]


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

Consider using vale GitHub Action when:

* The content repository is on GitHub.
* The goal is to measure or enforce the project compliance with the Style Guides.
* The content repository is on GitHub.

WARNING: Due to the GitHub token permissions, this Action can not post annotations to PRs from forked repositories.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@

Consider using the vale CLI with a continuous integration service when:

* The content repository is not on GitHub.
* The goal is to measure or enforce the project compliance with the Style Guides.

* xref:using-vale-github-action.adoc[] is not an option.


.Prerequisites
Expand All @@ -18,12 +17,19 @@ Consider using the vale CLI with a continuous integration service when:

.Procedure

* Use the official GitHub CLI tool to download the version of your choice from the releases page
. Configure your continuous integration service to download the `vale` CLI, the _RedHat_ style and the Vale configuration file using a `download_vale.sh` script such as:
+
[source,bash]
----
include::example$download_vale.sh[]
----


. Configure your continuous integration service to validate language changes using a `validate_language_changes.sh` script such as:
+
[source,bash]
----
$ gh release download --repo 'errata-ai/vale' -p 'vale_2.11.2_Linux_64-bit.tar.gz'
$ tar -xf 'vale_2.11.2_Linux_64-bit.tar.gz'
$ ./vale -v
include::example$validate_language_changes.sh[]
----

.Additional resources
Expand Down
24 changes: 24 additions & 0 deletions tools/download_vale.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/sh
#
# Copyright (c) 2021 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
set -e

# Download latest vale release
gh release download --repo 'errata-ai/vale' --pattern '*Linux*.tar.gz'
tar -xf vale*
./vale -v

# Download latest vale configuration from vale-at-red-hat
curl -Os https://raw.githubusercontent.com/vale-at-red-hat/vale-at-red-hat/master/.vale.ini

# Download latest _RedHat_ style
mkdir .vale/styles || true
cd .vale/styles
gh release download --repo 'vale-at-red-hat/vale-at-red-hat' --pattern 'RedHat.zip'
unzip RedHat.zip
22 changes: 22 additions & 0 deletions tools/validate_language_changes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/sh
#
# Copyright (c) 2021 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
set -e

vale -v

BRANCH=origin/${GITHUB_BASE_REF:-main}

FILES=$(git diff --name-only --diff-filter=AM "$BRANCH")

echo "Files added or modified, in comparison to branch $BRANCH:
$FILES"

# shellcheck disable=SC2086 (We want to split on spaces)
vale ${FILES}

0 comments on commit d0b81de

Please sign in to comment.