Get the FREE Ultimate OpenClaw Setup Guide →

github-projects

Scanned
npx machina-cli add skill existential-birds/beagle/github-projects --openclaw
Files (1)
SKILL.md
6.3 KB

GitHub Projects CLI

GitHub Projects (v2) management via gh project commands. Requires the project scope which can be added with gh auth refresh -s project.

Prerequisites

Verify authentication includes project scope:

gh auth status  # Check current scopes
gh auth refresh -s project  # Add project scope if missing

Quick Reference

List & View Projects

# List your projects
gh project list

# List org projects (including closed)
gh project list --owner ORG_NAME --closed

# View project details
gh project view PROJECT_NUM --owner OWNER

# Open in browser
gh project view PROJECT_NUM --owner OWNER --web

# JSON output with jq filtering
gh project list --format json | jq '.projects[] | {number, title}'

Create & Edit Projects

# Create project
gh project create --owner OWNER --title "Project Title"

# Edit project
gh project edit PROJECT_NUM --owner OWNER --title "New Title"
gh project edit PROJECT_NUM --owner OWNER --description "New description"
gh project edit PROJECT_NUM --owner OWNER --visibility PUBLIC

# Close/reopen project
gh project close PROJECT_NUM --owner OWNER
gh project close PROJECT_NUM --owner OWNER --undo  # Reopen

Link Projects to Repos

# Link to repo
gh project link PROJECT_NUM --owner OWNER --repo REPO_NAME

# Link to team
gh project link PROJECT_NUM --owner ORG --team TEAM_NAME

# Unlink
gh project unlink PROJECT_NUM --owner OWNER --repo REPO_NAME

Project Items

Add Existing Issues/PRs

# Add issue to project
gh project item-add PROJECT_NUM --owner OWNER --url https://github.com/OWNER/REPO/issues/123

# Add PR to project
gh project item-add PROJECT_NUM --owner OWNER --url https://github.com/OWNER/REPO/pull/456

Create Draft Items

gh project item-create PROJECT_NUM --owner OWNER --title "Draft item" --body "Description"

List Items

# List items (default 30)
gh project item-list PROJECT_NUM --owner OWNER

# List more items
gh project item-list PROJECT_NUM --owner OWNER --limit 100

# JSON output
gh project item-list PROJECT_NUM --owner OWNER --format json

Edit Items

Items are edited by their ID (obtained from item-list --format json).

# Edit draft issue title/body
gh project item-edit --id ITEM_ID --title "New Title" --body "New body"

# Update field value (requires field-id and project-id)
gh project item-edit --id ITEM_ID --project-id PROJECT_ID --field-id FIELD_ID --text "value"
gh project item-edit --id ITEM_ID --project-id PROJECT_ID --field-id FIELD_ID --number 42
gh project item-edit --id ITEM_ID --project-id PROJECT_ID --field-id FIELD_ID --date "2024-12-31"
gh project item-edit --id ITEM_ID --project-id PROJECT_ID --field-id FIELD_ID --single-select-option-id OPTION_ID
gh project item-edit --id ITEM_ID --project-id PROJECT_ID --field-id FIELD_ID --iteration-id ITER_ID

# Clear field value
gh project item-edit --id ITEM_ID --project-id PROJECT_ID --field-id FIELD_ID --clear

Archive/Delete Items

gh project item-archive PROJECT_NUM --owner OWNER --id ITEM_ID
gh project item-delete PROJECT_NUM --owner OWNER --id ITEM_ID

Project Fields

List Fields

gh project field-list PROJECT_NUM --owner OWNER
gh project field-list PROJECT_NUM --owner OWNER --format json

Create Fields

# Text field
gh project field-create PROJECT_NUM --owner OWNER --name "Notes" --data-type TEXT

# Number field
gh project field-create PROJECT_NUM --owner OWNER --name "Points" --data-type NUMBER

# Date field
gh project field-create PROJECT_NUM --owner OWNER --name "Due Date" --data-type DATE

# Single select with options
gh project field-create PROJECT_NUM --owner OWNER --name "Priority" \
  --data-type SINGLE_SELECT \
  --single-select-options "Low,Medium,High,Critical"

Delete Fields

gh project field-delete --id FIELD_ID

Common Workflows

Add Issue and Set Status

# 1. Add issue to project
gh project item-add 1 --owner "@me" --url https://github.com/owner/repo/issues/123

# 2. Get item ID and field IDs
gh project item-list 1 --owner "@me" --format json | jq '.items[-1]'
gh project field-list 1 --owner "@me" --format json

# 3. Update status field
gh project item-edit --id ITEM_ID --project-id PROJECT_ID \
  --field-id STATUS_FIELD_ID --single-select-option-id OPTION_ID

Bulk Add Issues

# Add all open issues from a repo
gh issue list --repo owner/repo --state open --json url -q '.[].url' | \
  xargs -I {} gh project item-add 1 --owner "@me" --url {}

JSON Output & jq Patterns

# Get project IDs
gh project list --format json | jq '.projects[] | {number, id, title}'

# Get field IDs and options
gh project field-list 1 --owner "@me" --format json | jq '.fields[] | {id, name, options}'

# Get item IDs with field values
gh project item-list 1 --owner "@me" --format json | jq '.items[] | {id, title, fieldValues}'

# Filter items by status
gh project item-list 1 --owner "@me" --format json | \
  jq '.items[] | select(.status == "In Progress")'

Reference Files

  • items.md: Item management, editing field values, bulk operations
  • fields.md: Field types, creating custom fields, option management

Command Summary

CommandPurpose
project listList projects
project viewView project details
project createCreate new project
project editModify project settings
project closeClose/reopen project
project link/unlinkConnect to repo/team
project item-addAdd existing issue/PR
project item-createCreate draft item
project item-listList project items
project item-editUpdate item fields
project item-archiveArchive item
project item-deleteRemove item
project field-listList project fields
project field-createAdd custom field
project field-deleteRemove field

Source

git clone https://github.com/existential-birds/beagle/blob/main/plugins/beagle-core/skills/github-projects/SKILL.mdView on GitHub

Overview

This skill enables managing GitHub Projects (v2) using gh project commands. It covers creating and editing projects, linking to repos or teams, adding items, creating custom fields, and automating project workflows to keep boards in sync with issues and PRs.

How This Skill Works

You use gh project commands (list, view, create, edit, item-add, item-create, item-edit, field-list, field-create, etc.) to manage projects, items, and fields. Before use, ensure the GitHub token includes the project scope (gh auth refresh -s project). Typical automation patterns involve scripting with JSON output (--format json) and parsing with jq for reliability.

When to Use It

  • Starting or managing GitHub Projects (v2) boards for a repository or organization
  • Adding existing issues or PRs to a project via their URLs
  • Creating or updating custom fields to capture extra metadata on items
  • Automating project workflows, such as updating items or fields in bulk
  • Auditing or scripting project boards, items, and permissions with gh project commands

Quick Start

  1. Step 1: Authenticate and grant project scope: gh auth status; gh auth refresh -s project
  2. Step 2: Create or list a project: gh project create --owner OWNER --title 'New Project' OR gh project list --owner OWNER
  3. Step 3: Add items or configure fields: gh project item-add PROJECT_NUM --owner OWNER --url https://github.com/OWNER/REPO/issues/1 OR gh project field-create PROJECT_NUM --owner OWNER --name 'Notes' --data-type TEXT

Best Practices

  • Verify project scope is granted: check gh auth status and refresh with gh auth refresh -s project
  • Use IDs (project-id, item-id, field-id) in scripts for stability instead of names
  • Output JSON when scripting: gh project ... --format json | jq '...'
  • Test changes on a staging or test project before applying to production boards
  • Document mappings between field IDs and human-friendly names to avoid confusion

Example Use Cases

  • Create a new sprint project: gh project create --owner YOUR_ORG --title 'Sprint 12'
  • Add an issue to a project: gh project item-add PROJECT_NUM --owner OWNER --url https://github.com/OWNER/REPO/issues/123
  • Create a draft item for a feature: gh project item-create PROJECT_NUM --owner OWNER --title 'New feature' --body 'Description'
  • Update a field value: gh project item-edit --id ITEM_ID --project-id PROJECT_ID --field-id FIELD_ID --text 'In Progress'
  • Unlink a project from a repo: gh project unlink PROJECT_NUM --owner OWNER --repo REPO_NAME

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers