Repository navigation
Expand file tree
/
Copy pathaction.yml
More file actions
44 lines (44 loc) · 1.64 KB
/
Copy pathaction.yml
File metadata and controls
44 lines (44 loc) · 1.64 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
name: "Setup Copilot"
description: "Setup Copilot based on the project's package.json file."
outputs:
cli-path:
description: "Path to the Copilot CLI"
value: ${{ steps.cli-path.outputs.path }}
javascript-cli-path:
description: "Path to the JavaScript Copilot CLI entrypoint"
value: ${{ steps.cli-path.outputs.javascript-path }}
runs:
using: "composite"
steps:
- uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0
if: runner.os != 'Windows'
with:
cache: "npm"
cache-dependency-path: "./nodejs/package-lock.json"
node-version: 22
- uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0
if: runner.os == 'Windows'
with:
node-version: 22
- name: Install dependencies
run: npm --prefix "$(pwd)/nodejs" ci --ignore-scripts
shell: bash
- name: Set CLI path
id: cli-path
run: |
cli_path=$(npm --prefix "$(pwd)/nodejs" run --silent prepare:runtime -- --print-path)
if [ -z "$cli_path" ]; then
echo "Could not prepare the Copilot CLI runtime" >&2
exit 1
fi
javascript_cli_path=$(npm --prefix "$(pwd)/nodejs" run --silent prepare:runtime -- --print-legacy-path)
if [ -z "$javascript_cli_path" ]; then
echo "Could not prepare the Copilot CLI JavaScript entrypoint" >&2
exit 1
fi
echo "path=$cli_path" >> $GITHUB_OUTPUT
echo "javascript-path=$javascript_cli_path" >> $GITHUB_OUTPUT
shell: bash
- name: Verify CLI works
run: node "${{ steps.cli-path.outputs.javascript-path }}" --version
shell: bash