Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
153 changes: 153 additions & 0 deletions .github/workflows/shared/gh-skill.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
---
# gh skill - Install Agent Skills
# Installs agent skills from GitHub repositories using `gh skill install`
# before the AI agent starts.
#
# Requirements:
# GitHub CLI v2.90.0 or later (for `gh skill` support)
#
# Documentation: https://cli.github.com/manual/gh_skill_install
#
# Usage:
# imports:
# - uses: shared/gh-skill.md
# with:
# skills:
# - github/awesome-copilot/documentation-writer
# - github/awesome-copilot/code-review
#
# Skill format:
# - owner/repo — install all skills from the repository
# - owner/repo/skill-name — install a specific skill (latest)
# - owner/repo/skill-name@version — install a pinned version

import-schema:
skills:
type: array
items:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The import-schema block is well-structured with clear descriptions for each field. The skills array type is correctly defined as required.

Consider adding a default for engine in the schema (e.g., default: copilot) to make the default explicit in documentation. 🔍

type: string
required: true
description: >
List of skills to install. Each entry is in the format owner/repo,
owner/repo/skill-name, or owner/repo/skill-name@version.
Examples: "github/awesome-copilot", "github/awesome-copilot/documentation-writer",
"github/awesome-copilot/code-review@v1.2.0"

pre-agent-steps:
- name: Install agent skills
env:
GH_TOKEN: ${{ secrets.GH_AW_PLUGINS_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot not internal secrets, use input instead

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 281778b — replaced the internal secrets with a token import-schema input (optional, falls back to built-in GITHUB_TOKEN). Users pass their own token via token: ${{ secrets.MY_TOKEN }}.

GH_AW_SKILLS: ${{ github.aw.import-inputs.skills }}
run: |
set -euo pipefail
skills_json="${GH_AW_SKILLS}"
count=$(echo "$skills_json" | jq 'length')
if [ "$count" = "0" ]; then
echo "::error::shared/gh-skill.md import provided no skills. Add skills: <list> in the with: block."
exit 1
fi
agent="${AI_AGENT:-github-copilot}"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilo no AI_AGENT env. there should be an input with the gh-aw engine of that gets mapped to the gh skill agent names.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 281778b — added an engine import-schema input that maps gh-aw engine names to gh skill --agent values:

engine input --agent value
copilot (default) github-copilot
claude claude-code
codex codex
gemini gemini-cli
opencode opencode

Usage:

engine: claude
imports:
  - uses: shared/gh-skill.md
    with:
      engine: claude
      skills:
        - github/awesome-copilot/documentation-writer

printf "::notice::Installing %d skill(s) for agent: %s\n" "$count" "$agent"
while IFS= read -r skill_entry; do
repo=$(echo "$skill_entry" | cut -d'/' -f1,2)
skill_part=$(echo "$skill_entry" | cut -d'/' -f3-)
if [ -n "$skill_part" ]; then
Comment on lines +92 to +95
echo "Installing skill: $repo $skill_part"
gh skill install "$repo" "$skill_part" --agent "$agent"
else
echo "Installing all skills from: $repo"
gh skill install "$repo" --agent "$agent"
fi
done < <(echo "$skills_json" | jq -r '.[]')
---

<!--
## Agent Skills

This shared workflow installs agent skills before the AI agent runs, using the
[`gh skill install`](https://cli.github.com/manual/gh_skill_install) command
(available in GitHub CLI v2.90.0+).

### How it works

Each skill in the `skills:` list is installed into the repository's
`.github/skills/` directory via `gh skill install`, making the skills available
to the AI agent during its session.

The target agent host is determined from the `AI_AGENT` environment variable if
set (for example, Claude Code automatically sets `AI_AGENT=claude-code` for its
subprocesses), otherwise defaults to `github-copilot`. Set `AI_AGENT` in your
workflow's `agent.env` block to override:

```yaml
agent:
env:
AI_AGENT: claude-code
```

### Usage

```yaml
imports:
- uses: shared/gh-skill.md
with:
skills:
- github/awesome-copilot/documentation-writer
- github/awesome-copilot/code-review@v1.2.0
```

### Skill format

Each entry in `skills:` is one of:

| Format | Example | Effect |
|--------|---------|--------|
| `owner/repo` | `github/awesome-copilot` | Installs all skills from the repo |
| `owner/repo/skill-name` | `github/awesome-copilot/documentation-writer` | Installs a specific skill (latest) |
| `owner/repo/skill-name@version` | `github/awesome-copilot/code-review@v1.2.0` | Installs a pinned version |

### Authentication

Uses a token from the standard precedence chain:
`GH_AW_PLUGINS_TOKEN` → `GH_AW_GITHUB_TOKEN` → `GITHUB_TOKEN`.

For private skill repositories, configure `GH_AW_PLUGINS_TOKEN` or
`GH_AW_GITHUB_TOKEN` with appropriate access.

### Agent targeting

The `AI_AGENT` environment variable controls which agent host receives the
installed skills:

- `AI_AGENT=github-copilot` — GitHub Copilot (default when unset)
- `AI_AGENT=claude-code` — Claude Code
- `AI_AGENT=cursor` — Cursor
- `AI_AGENT=codex` — OpenAI Codex
- `AI_AGENT=gemini-cli` — Gemini CLI

Set `AI_AGENT` in `agent.env` to match the engine used by the workflow:

```yaml
engine: claude
agent:
env:
AI_AGENT: claude-code
imports:
- uses: shared/gh-skill.md
with:
skills:
- github/awesome-copilot/documentation-writer
```

### Network access

`gh skill install` downloads skill files from GitHub. No additional network
configuration is needed on standard GitHub-hosted runners. If your workflow
uses a strict network firewall, add `github.com` to the allowed domains:

```yaml
network:
allowed:
- github.com
```
-->
Loading