Skip to content

Commit f702536

Browse files
authored
Merge pull request riscv#23 from kbroch-rivosinc/dev/kbroch/yamlfmt-pre-commit
add yamlfmt pre-commit hook
2 parents b37d0a3 + 7a44cfb commit f702536

File tree

3 files changed

+69
-60
lines changed

3 files changed

+69
-60
lines changed

.github/workflows/build-pdf.yml

+41-40
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
name: Create Specification Document
23

34
# The workflow is triggered by pull request, push to main, and manual dispatch.
@@ -9,17 +10,17 @@ on:
910
required: true
1011
type: string
1112
revision_mark:
12-
description: 'Set revision mark as Draft, Release or Stable:'
13-
required: true
14-
type: string
15-
default: 'Draft'
13+
description: 'Set revision mark as Draft, Release or Stable:'
14+
required: true
15+
type: string
16+
default: Draft
1617
prerelease:
17-
description: 'Tag as a pre-release?'
18+
description: Tag as a pre-release?
1819
required: false
1920
type: boolean
2021
default: true
2122
draft:
22-
description: 'Create release as a draft?'
23+
description: Create release as a draft?
2324
required: false
2425
type: boolean
2526
default: false
@@ -33,41 +34,41 @@ jobs:
3334
runs-on: ubuntu-latest
3435

3536
steps:
36-
# Step 1: Checkout the repository
37-
- name: Checkout repository
38-
uses: actions/checkout@v3
39-
with:
40-
submodules: 'recursive'
37+
# Step 1: Checkout the repository
38+
- name: Checkout repository
39+
uses: actions/checkout@v3
40+
with:
41+
submodules: recursive
4142

42-
# Step 2: Pull the latest RISC-V Docs container image
43-
- name: Pull Container
44-
run: docker pull riscvintl/riscv-docs-base-container-image:latest
43+
# Step 2: Pull the latest RISC-V Docs container image
44+
- name: Pull Container
45+
run: docker pull riscvintl/riscv-docs-base-container-image:latest
4546

46-
# Step 3: Build Files
47-
- name: Build Files
48-
run: make
49-
env:
50-
VERSION: v${{ github.event.inputs.version }}
51-
REVMARK: ${{ github.event.inputs.revision_mark }}
47+
# Step 3: Build Files
48+
- name: Build Files
49+
run: make
50+
env:
51+
VERSION: v${{ github.event.inputs.version }}
52+
REVMARK: ${{ github.event.inputs.revision_mark }}
5253

53-
# Step 4: Upload the built PDF files as a single artifact
54-
- name: Upload Build Artifacts
55-
uses: actions/upload-artifact@v3
56-
with:
57-
name: Build Artifacts
58-
path: ${{ github.workspace }}/*.pdf
59-
retention-days: 30
54+
# Step 4: Upload the built PDF files as a single artifact
55+
- name: Upload Build Artifacts
56+
uses: actions/upload-artifact@v3
57+
with:
58+
name: Build Artifacts
59+
path: ${{ github.workspace }}/*.pdf
60+
retention-days: 30
6061

61-
# Create Release
62-
- name: Create Release
63-
uses: softprops/action-gh-release@v1
64-
with:
65-
files: ${{ github.workspace }}/*.pdf
66-
tag_name: v${{ github.event.inputs.version }}
67-
name: Release ${{ github.event.inputs.version }}
68-
draft: ${{ github.event.inputs.draft }}
69-
prerelease: ${{ github.event.inputs.prerelease }}
70-
env:
71-
GITHUB_TOKEN: ${{ secrets.GHTOKEN }}
72-
if: github.event_name == 'workflow_dispatch'
73-
# This condition ensures this step only runs for workflow_dispatch events.
62+
# Create Release
63+
- name: Create Release
64+
uses: softprops/action-gh-release@v1
65+
with:
66+
files: ${{ github.workspace }}/*.pdf
67+
tag_name: v${{ github.event.inputs.version }}
68+
name: Release ${{ github.event.inputs.version }}
69+
draft: ${{ github.event.inputs.draft }}
70+
prerelease: ${{ github.event.inputs.prerelease }}
71+
env:
72+
GITHUB_TOKEN: ${{ secrets.GHTOKEN }}
73+
if: github.event_name == 'workflow_dispatch'
74+
# This condition ensures this step only runs for workflow_dispatch events.

.github/workflows/pre-commit.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
name: pre-commit
23

34
on:
@@ -9,6 +10,6 @@ jobs:
910
pre-commit:
1011
runs-on: ubuntu-latest
1112
steps:
12-
- uses: actions/checkout@v3
13-
- uses: actions/setup-python@v3
14-
- uses: pre-commit/[email protected]
13+
- uses: actions/checkout@v3
14+
- uses: actions/setup-python@v3
15+
- uses: pre-commit/[email protected]

.pre-commit-config.yaml

+24-17
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,26 @@
1+
---
12
repos:
2-
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v4.5.0
4-
hooks:
5-
- id: check-json
6-
- id: check-symlinks
7-
- id: check-yaml
8-
- id: end-of-file-fixer
9-
- id: trailing-whitespace
10-
args: [--markdown-linebreak-ext=md]
3+
- repo: https://github.com/pre-commit/pre-commit-hooks
4+
rev: v4.5.0
5+
hooks:
6+
- id: check-json
7+
- id: check-symlinks
8+
- id: check-yaml
9+
- id: end-of-file-fixer
10+
- id: trailing-whitespace
11+
args: [--markdown-linebreak-ext=md]
1112

12-
- repo: local
13-
hooks:
14-
- id: forbidden-file-extensions
15-
name: forbidden-file-extensions
16-
entry: disallow these file extensions
17-
language: fail
18-
# Disallow other asciidoc extensions except .adoc
19-
files: .*\.(asciidoc|asc)$
13+
- repo: local
14+
hooks:
15+
- id: forbidden-file-extensions
16+
name: forbidden-file-extensions
17+
entry: disallow these file extensions
18+
language: fail
19+
# Disallow other asciidoc extensions except .adoc
20+
files: .*\.(asciidoc|asc)$
21+
22+
- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt
23+
rev: 0.2.3
24+
hooks:
25+
- id: yamlfmt
26+
args: [--mapping, '2', --sequence, '4', --offset, '2']

0 commit comments

Comments
 (0)