-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
103 lines (91 loc) · 2.92 KB
/
Copy pathaction.yml
File metadata and controls
103 lines (91 loc) · 2.92 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
name: x402 Surface Check
description: Run a no-payment x402, MPP, or HTTP 402 launch-surface check in GitHub Actions.
author: Tate Lyman
branding:
icon: credit-card
color: green
inputs:
target:
description: Manifest, OpenAPI spec, x402 resource catalog, pasted JSON URL, or direct paid endpoint URL to check.
required: true
output:
description: Optional file path to write the Markdown or JSON report.
required: false
default: ""
endpoint:
description: Set to true when target is one direct paid endpoint instead of a manifest or OpenAPI document.
required: false
default: "false"
method:
description: HTTP method for direct endpoint mode.
required: false
default: "POST"
body:
description: Optional JSON request body for direct endpoint mode. Do not put secrets here.
required: false
default: ""
origin:
description: Optional browser Origin to use for CORS preflight checks.
required: false
default: ""
limit:
description: Maximum endpoints to probe from a manifest or OpenAPI document.
required: false
default: "6"
strict-cache:
description: Set to true to flag missing Cache-Control on no-payment 402 challenge responses.
required: false
default: "false"
json:
description: Set to true to print JSON instead of Markdown.
required: false
default: "false"
version:
description: x402-surface-check npm version to run.
required: false
default: "latest"
runs:
using: composite
steps:
- name: Run x402 Surface Check
shell: bash
env:
X402_TARGET: ${{ inputs.target }}
X402_OUTPUT: ${{ inputs.output }}
X402_ENDPOINT: ${{ inputs.endpoint }}
X402_METHOD: ${{ inputs.method }}
X402_BODY: ${{ inputs.body }}
X402_ORIGIN: ${{ inputs.origin }}
X402_LIMIT: ${{ inputs.limit }}
X402_STRICT_CACHE_INPUT: ${{ inputs.strict-cache }}
X402_JSON: ${{ inputs.json }}
X402_VERSION: ${{ inputs.version }}
run: |
args=()
if [[ "$X402_ENDPOINT" == "true" ]]; then
args+=("--endpoint" "--method" "$X402_METHOD")
fi
if [[ -n "$X402_BODY" ]]; then
args+=("--body" "$X402_BODY")
fi
if [[ -n "$X402_ORIGIN" ]]; then
args+=("--origin" "$X402_ORIGIN")
fi
if [[ -n "$X402_LIMIT" ]]; then
args+=("--limit" "$X402_LIMIT")
fi
if [[ "$X402_STRICT_CACHE_INPUT" == "true" ]]; then
args+=("--strict-cache")
fi
if [[ "$X402_JSON" == "true" ]]; then
args+=("--json")
fi
args+=("$X402_TARGET")
if [[ -n "$X402_OUTPUT" ]]; then
mkdir -p "$(dirname "$X402_OUTPUT")"
args+=("$X402_OUTPUT")
npx --yes "x402-surface-check@$X402_VERSION" "${args[@]}"
cat "$X402_OUTPUT"
exit 0
fi
npx --yes "x402-surface-check@$X402_VERSION" "${args[@]}"