-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathaction.yml
More file actions
130 lines (119 loc) · 4.21 KB
/
Copy pathaction.yml
File metadata and controls
130 lines (119 loc) · 4.21 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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# Copyright Advanced Micro Devices, Inc.
#
# SPDX-License-Identifier: MIT
name: skillscope
description: >-
Run one skillscope command against the calling repository, from this
action's own checkout.
# Pin the tag you want to run, the same way you pin the reusable workflow:
#
# - uses: amd/skillscope@v0.1.3
#
# The Python in that checkout is the harness. There is no second version to
# resolve, and nothing here fetches a different ref.
inputs:
command:
description: 'The skillscope subcommand: structural, routing, behavioral, select, list-skills, template.'
required: true
args:
description: "Further arguments for the subcommand, shell-quoted."
required: false
default: ""
skills:
description: >-
Globs naming the directories that are skills, comma-separated. Passed
through to the harness as --skills-dir. Default: ./*, every directory
at the repo root.
required: false
default: ""
repo:
description: "Root of the repo to test. Default: the workspace."
required: false
default: "."
stdin:
description: "A file to feed the command on stdin (`select --changed` reads one)."
required: false
default: ""
python-version:
description: "Python for the harness. Default: 3.12."
required: false
default: "3.12"
setup-python:
description: "Set up Python. Turn off on a runner where it is already pinned."
required: false
default: "true"
install-claude:
description: >-
Install Node and the claude CLI. Needed by `routing` and `behavioral`,
pointless for `structural` and `select`.
required: false
default: "false"
node-version:
description: "Node for the claude CLI. Default: 20."
required: false
default: "20"
outputs:
version:
description: "The harness version that ran, read from the checkout it ran from."
value: ${{ steps.skillscope.outputs.version }}
stdout:
description: >-
The last line of the command's output. For `select` that is the plan
JSON; other commands report through the step summary.
value: ${{ steps.skillscope.outputs.stdout }}
runs:
using: composite
steps:
- name: Set up Python
if: inputs.setup-python == 'true'
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
- name: Set up uv
uses: astral-sh/setup-uv@v7
- name: Set up Node
if: inputs.install-claude == 'true'
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
# Python, not bash: a composite action must name a shell on every `run:`, so
# it cannot fall back to the runner's default the way a workflow step can.
# A leg lands on whatever platform its skill asked for, and a self-hosted
# Windows runner need not have bash -- naming it here is what turns that
# into `bash: command not found` on a step that is really about npm.
- name: Install the claude CLI
if: inputs.install-claude == 'true'
shell: python
run: |
import shutil
import subprocess
import sys
# `npm` is `npm.cmd` on Windows, and only a PATH lookup finds it.
npm = shutil.which("npm")
if npm is None:
sys.exit(
"error: npm is not on PATH. The `Set up Node` step before this "
"one should have put it there."
)
sys.exit(
subprocess.run([npm, "install", "-g", "@anthropic-ai/claude-code"]).returncode
)
# One step, in Python, because the same launcher runs on Linux, Windows,
# and macOS runners and a shell script would need three of itself.
- name: Run skillscope
id: skillscope
shell: python
env:
SKILLSCOPE_COMMAND: ${{ inputs.command }}
SKILLSCOPE_ARGS: ${{ inputs.args }}
SKILLSCOPE_REPO: ${{ inputs.repo }}
SKILLSCOPE_SKILLS: ${{ inputs.skills }}
SKILLSCOPE_STDIN: ${{ inputs.stdin }}
SKILLSCOPE_ACTION_PATH: ${{ github.action_path }}
run: |
import os
import runpy
import sys
launcher = os.path.join(os.environ["SKILLSCOPE_ACTION_PATH"], "bootstrap", "launch.py")
sys.argv = [launcher]
runpy.run_path(launcher, run_name="__main__")