-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathaction.yml
More file actions
82 lines (77 loc) · 2.93 KB
/
Copy pathaction.yml
File metadata and controls
82 lines (77 loc) · 2.93 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
name: doc-bridge-gate
description: Run doc-bridge index freshness and configured gates on pull requests
branding:
icon: book
color: blue
inputs:
config-path:
description: Path to doc-bridge.config.json (default discovers from repo root)
required: false
default: ''
gate:
description: Optional single gate id (default runs all configured gates)
required: false
default: ''
node-version:
description: Node.js version for ak-docs
required: false
default: '22'
package-version:
description: Exact @agentskit/doc-bridge npm version (kept in sync with this Action release)
required: false
default: '1.7.45'
runs:
using: composite
steps:
- name: Setup Node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v4
with:
node-version: ${{ inputs.node-version }}
- name: Install ak-docs
shell: bash
env:
DOC_BRIDGE_PACKAGE_VERSION: ${{ inputs.package-version }}
run: |
if [[ ! "$DOC_BRIDGE_PACKAGE_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?$ ]]; then
echo "::error title=Invalid package-version::Use an exact semver version such as 1.2.1"
exit 2
fi
# When this Action runs against the Doc Bridge repository itself (CI dogfood),
# install the workspace package so gates exercise the PR under test — not a
# stale published npm version that may lag the local ecosystem contract.
if [ -f package.json ] && [ "$(node -p "try{require('./package.json').name}catch{''}")" = "@agentskit/doc-bridge" ]; then
npm install -g .
else
npm install -g "@agentskit/doc-bridge@${DOC_BRIDGE_PACKAGE_VERSION}"
fi
- name: Run gates
shell: bash
env:
DOC_BRIDGE_CONFIG_PATH: ${{ inputs.config-path }}
DOC_BRIDGE_GATE_ID: ${{ inputs.gate }}
run: |
if [ -n "$DOC_BRIDGE_GATE_ID" ] && [ -n "$DOC_BRIDGE_CONFIG_PATH" ]; then
ak-docs gate run "$DOC_BRIDGE_GATE_ID" --config "$DOC_BRIDGE_CONFIG_PATH"
elif [ -n "$DOC_BRIDGE_GATE_ID" ]; then
ak-docs gate run "$DOC_BRIDGE_GATE_ID"
elif [ -n "$DOC_BRIDGE_CONFIG_PATH" ]; then
ak-docs gate run --config "$DOC_BRIDGE_CONFIG_PATH"
else
ak-docs gate run
fi
- name: Doctor coverage (annotation)
shell: bash
continue-on-error: true
env:
DOC_BRIDGE_CONFIG_PATH: ${{ inputs.config-path }}
run: |
if [ -n "$DOC_BRIDGE_CONFIG_PATH" ]; then
REPORT="$(ak-docs doctor --text --config "$DOC_BRIDGE_CONFIG_PATH" 2>&1 || true)"
else
REPORT="$(ak-docs doctor --text 2>&1 || true)"
fi
echo "$REPORT"
SCORE="$(echo "$REPORT" | sed -n 's/^Score: \([0-9]*\)\/.*/\1/p' | head -1)"
if [ -n "$SCORE" ]; then
echo "::notice title=doc-bridge coverage::Score ${SCORE}/100 — run ak-docs doctor locally for next actions"
fi