-
Notifications
You must be signed in to change notification settings - Fork 1
71 lines (63 loc) · 2.26 KB
/
copilot-setup-steps.yml
File metadata and controls
71 lines (63 loc) · 2.26 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
name: "Copilot Setup Steps"
# This workflow configures the environment for GitHub Copilot Agent with gh-aw MCP server
on:
workflow_dispatch:
inputs:
run_workflows:
description: Trigger the published workflows on this repo
required: false
default: false
type: boolean
push:
paths:
- .github/workflows/copilot-setup-steps.yml
jobs:
# The job MUST be called 'copilot-setup-steps' to be recognized by GitHub Copilot Agent
copilot-setup-steps:
runs-on: ubuntu-latest
# Set minimal permissions for setup steps
# Copilot Agent receives its own token with appropriate permissions
permissions:
actions: write
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Install gh-aw extension
uses: github/gh-aw-actions/setup-cli@bc56a0cad2f450c562810785ef38649c04db812a # v0.72.1
with:
version: v0.72.1
- name: Smoke test published workflows via gh aw add
env:
GH_TOKEN: ${{ github.token }}
SOURCE_DIR: ${{ github.workspace }}/workflows
run: |
set -euo pipefail
temp_dir="$(mktemp -d)"
trap 'rm -rf "$temp_dir"' EXIT
cd "$temp_dir"
git init -q
gh aw add "$SOURCE_DIR/copilot-token-audit.md" "$SOURCE_DIR/copilot-token-optimizer.md"
gh aw compile --validate --no-emit
- name: Validate published workflows
env:
GH_TOKEN: ${{ github.token }}
SOURCE_DIR: ${{ github.workspace }}/workflows
run: |
set -euo pipefail
gh aw compile --dir workflows --validate --no-emit
- name: Run published workflows on this repo
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.run_workflows == 'true' }}
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
gh aw run copilot-token-audit --ref "${{ github.ref_name }}"
gh aw run copilot-token-optimizer --ref "${{ github.ref_name }}"
- name: Upload trial results
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: gh-aw-trial-results
path: trials/
if-no-files-found: ignore