From a36a3f794fb4608195a1966c4f738295225c3d0a Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 28 Jan 2026 05:07:45 +0000 Subject: [PATCH] Add GitHub Workflows skill skeleton and build script - Create SKILL.md with frontmatter describing how to use gh CLI to list and execute workflow dispatch operations - Add build.sh script to package skill into a zip file - Add .gitignore to exclude dist/ build output https://claude.ai/code/session_01Lv6oDMDseYEGpTErveeYEQ --- .gitignore | 2 + SKILL.md | 109 +++++++++++++++++++++++++++++++++++++++++++++++++++++ build.sh | 22 +++++++++++ 3 files changed, 133 insertions(+) create mode 100644 .gitignore create mode 100644 SKILL.md create mode 100755 build.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d77f6bd --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +# Build output +dist/ diff --git a/SKILL.md b/SKILL.md new file mode 100644 index 0000000..953b2b1 --- /dev/null +++ b/SKILL.md @@ -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 +``` + +## 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/.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 +``` + +To trigger with input parameters: + +```bash +gh workflow run -f param1=value1 -f param2=value2 +``` + +To trigger on a specific branch: + +```bash +gh workflow run --ref +``` + +To trigger with inputs from a JSON file: + +```bash +gh workflow run --json < inputs.json +``` + +## Monitoring Workflow Runs + +After triggering a workflow, list recent runs: + +```bash +gh run list --workflow= +``` + +To watch a run in progress: + +```bash +gh run watch +``` + +To view run details: + +```bash +gh run view +``` + +To view run logs: + +```bash +gh run view --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 && sleep 2 && gh run watch $(gh run list --workflow= --limit 1 --json databaseId -q '.[0].databaseId') +``` diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..53dc441 --- /dev/null +++ b/build.sh @@ -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"