WIP: Add vale #9
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Linting | |
on: | |
pull_request: | |
types: [synchronize, ready_for_review, opened] | |
concurrency: | |
cancel-in-progress: true | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
jobs: | |
check: | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- name: Check if manual review has been performed | |
uses: actions/github-script@v7 | |
id: labels | |
with: | |
result-encoding: string | |
script: | | |
const { data: labels } = await github.rest.issues.listLabelsOnIssue({ | |
...context.repo, | |
issue_number: context.issue.number | |
}); | |
return labels.map(l => l.name).includes('ci:manual-approve:linting') | |
outputs: | |
result: ${{ steps.labels.outputs.result }} | |
vale: | |
needs: check | |
if: needs.check.outputs.result == 'false' | |
name: Vale | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- name: Get changed files | |
id: changed-files | |
uses: tj-actions/changed-files@v45 | |
with: | |
sha: ${{ github.sha }} | |
files: | | |
app/**/*.md | |
app/_landing_pages/**/*.yaml | |
files_ignore: | | |
app/assets/** | |
json: true | |
quotepath: false | |
escape_json: false | |
- uses: mheap/vale-action@reviewdog | |
if: steps.changed-files.outputs.any_changed == 'true' | |
with: | |
fail_on_error: true | |
files: '${{ steps.changed-files.outputs.all_changed_files }}' | |
filter_mode: file | |
reporter: github-pr-annotations | |
reviewdog_url: https://github.com/mheap/reviewdog/releases/download/v10.0.0/reviewdog_10.0.0_Linux_x86_64.tar.gz | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
vale-frontmatter: | |
needs: check | |
if: needs.check.outputs.result == 'false' | |
name: Vale on Frontmatters | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- name: Get changed files | |
id: changed-files | |
uses: tj-actions/changed-files@v45 | |
with: | |
sha: ${{ github.sha }} | |
files: | | |
app/**/*.md | |
files_ignore: | | |
app/assets/** | |
json: true | |
quotepath: false | |
escape_json: false | |
- name: Prepare Frontmatters for Vale | |
env: | |
CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} | |
run: | | |
cd tools/vale-frontmatter | |
npm ci | |
node index.js $CHANGED_FILES | |
- uses: mheap/vale-action@reviewdog | |
if: steps.changed-files.outputs.any_changed == 'true' | |
with: | |
fail_on_error: true | |
files: '${{ steps.changed-files.outputs.all_changed_files }}' | |
filter_mode: file | |
reporter: github-pr-annotations | |
reviewdog_url: https://github.com/mheap/reviewdog/releases/download/v10.0.0/reviewdog_10.0.0_Linux_x86_64.tar.gz | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} |