Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Build output
dist/
109 changes: 109 additions & 0 deletions SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
---
name: GitHub Workflows
description: List and execute GitHub Actions workflow dispatch operations using the GitHub CLI
tools:
- Bash
---

# GitHub Workflows Skill

This skill enables listing and executing GitHub Actions workflow dispatch operations using the GitHub CLI (`gh`).

## Prerequisites

- GitHub CLI (`gh`) must be installed and available in PATH
- User must be authenticated to GitHub via `gh auth login`

## Listing Workflows

To list all workflows in a repository:

```bash
gh workflow list
```

This displays workflow names, states, and IDs.

To view details of a specific workflow, including whether it supports `workflow_dispatch`:

```bash
gh workflow view <workflow-name-or-id>
```

## Identifying Workflow Dispatch Workflows

Workflows that support manual triggering have `workflow_dispatch` as a trigger event. To check if a workflow supports dispatch, examine the workflow file:

```bash
gh api repos/{owner}/{repo}/contents/.github/workflows/<workflow-file>.yml --jq '.content' | base64 -d | head -50
```

Or list workflows and look for those with a "workflow_dispatch" trigger in their definition.

## Executing Workflow Dispatch

To trigger a workflow dispatch:

```bash
gh workflow run <workflow-name-or-id>
```

To trigger with input parameters:

```bash
gh workflow run <workflow-name-or-id> -f param1=value1 -f param2=value2
```

To trigger on a specific branch:

```bash
gh workflow run <workflow-name-or-id> --ref <branch-name>
```

To trigger with inputs from a JSON file:

```bash
gh workflow run <workflow-name-or-id> --json < inputs.json
```

## Monitoring Workflow Runs

After triggering a workflow, list recent runs:

```bash
gh run list --workflow=<workflow-name-or-id>
```

To watch a run in progress:

```bash
gh run watch <run-id>
```

To view run details:

```bash
gh run view <run-id>
```

To view run logs:

```bash
gh run view <run-id> --log
```

## Common Patterns

### List all dispatchable workflows

```bash
gh workflow list | while read -r name state id; do
gh workflow view "$id" 2>/dev/null | grep -q "workflow_dispatch" && echo "$name ($id)"
done
```

### Trigger and wait for completion

```bash
gh workflow run <workflow-name> && sleep 2 && gh run watch $(gh run list --workflow=<workflow-name> --limit 1 --json databaseId -q '.[0].databaseId')
```
22 changes: 22 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash
# Build script for GitHub Workflows Claude Code Skill
# Outputs a zip file containing the skill

set -e

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
SKILL_NAME="github-workflows-skill"
OUTPUT_DIR="${SCRIPT_DIR}/dist"
OUTPUT_FILE="${OUTPUT_DIR}/${SKILL_NAME}.zip"

# Create output directory if it doesn't exist
mkdir -p "$OUTPUT_DIR"

# Remove existing zip if present
rm -f "$OUTPUT_FILE"

# Create the zip file containing the skill
cd "$SCRIPT_DIR"
zip -r "$OUTPUT_FILE" SKILL.md

echo "Skill package created: $OUTPUT_FILE"