Repository navigation
Expand file tree
/
Copy pathaction.yml
More file actions
108 lines (101 loc) · 3.81 KB
/
Copy pathaction.yml
File metadata and controls
108 lines (101 loc) · 3.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
name: Check docs against the knowledge base contract
description: >-
Run the knowledge base contract checks on a repository's built headless
documentation site, on a pull request, without releasing or uploading
anything. Findings are annotated by rule ID and summarised on the run.
author: AbsaOSS
branding:
icon: check-circle
color: purple
inputs:
manifest:
description: >-
Path to the repository's kb-docs.json, relative to the workspace.
required: false
default: kb-docs.json
dist:
description: >-
The built headless output, relative to the workspace — the same value the
publish-docs workflow passes. With one app in the manifest this is that
app's directory; with several, it holds one subdirectory per slug.
required: false
default: dist
strict:
description: >-
"true" fails the check on warnings as well as errors. Errors always fail
it: they are what the publish-docs action refuses to release.
required: false
default: 'false'
npm-registry:
description: >-
npm registry to install the action's own dependencies from, for runners
that cannot reach registry.npmjs.org — an Artifactory npm remote, say.
Empty means whatever npm resolves on the runner, which is the public
registry unless the machine's npm configuration says otherwise.
required: false
default: ''
npm-token:
description: >-
Bearer token for `npm-registry`. Leave empty for a registry that allows
anonymous reads.
required: false
default: ''
node-mirror:
description: >-
Mirror of https://nodejs.org to download Node from, for runners that can
reach neither nodejs.org nor the github.com release assets `setup-node`
tries first. Not needed when the runner image already carries Node in its
tool cache.
required: false
default: ''
node-mirror-token:
description: Authorization header value for `node-mirror`.
required: false
default: ''
outputs:
errors:
description: Number of error findings.
value: ${{ steps.check.outputs.errors }}
warnings:
description: Number of warning findings.
value: ${{ steps.check.outputs.warnings }}
runs:
using: composite
steps:
# The same pinned toolchain and dependency tree the publishing actions use,
# so a pull request is checked by exactly the code that will check the
# release.
- name: Set up Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: '20'
mirror: ${{ inputs.node-mirror }}
mirror-token: ${{ inputs.node-mirror-token }}
# See publish-docs/action.yml: project-level npm config next to the
# lockfile, reaching nothing outside this install. Skipped when unset.
- name: Point npm at a private registry
if: ${{ inputs.npm-registry != '' }}
shell: bash
working-directory: ${{ github.action_path }}/..
env:
KB_NPM_REGISTRY: ${{ inputs.npm-registry }}
KB_NPM_TOKEN: ${{ inputs.npm-token }}
run: bash "$GITHUB_ACTION_PATH/../lib/npm-registry.sh"
- name: Install checker dependencies
shell: bash
working-directory: ${{ github.action_path }}/..
env:
# Expanded by npm from the .npmrc the previous step wrote; the token is
# never written to disk.
KB_NPM_TOKEN: ${{ inputs.npm-token }}
run: npm ci --omit=dev --no-audit --no-fund
# Runs in the workspace, and the paths go in as the user wrote them, so the
# findings name `kb-docs.json` and `dist/…` rather than runner paths.
- name: Check the built output
id: check
shell: bash
run: node "$GITHUB_ACTION_PATH/src/index.js"
env:
KB_MANIFEST: ${{ inputs.manifest }}
KB_DIST: ${{ inputs.dist }}
KB_CHECK_STRICT: ${{ inputs.strict }}