home / skills / openclaw / skills / github-deploy-skill

github-deploy-skill skill

/skills/cruciata/github-deploy-skill

This skill automates committing and pushing code to GitHub, with optional repository creation and deployment hints to streamline project deployment.

npx playbooks add skill openclaw/skills --skill github-deploy-skill

Review the files below or copy the command above to add this skill to your agents.

Files (3)
SKILL.md
1.8 KB
---
name: GitHub Deploy Skill
slug: github-deploy-skill
version: 1.0.0
description: Commit and push local project changes to GitHub, with optional repo creation and deployment hints.
author: cruciata
tags:
  - latest
  - github
  - deploy
  - powershell
---

# GitHub Deploy Skill

This skill provides a reusable PowerShell script for Windows to automate:

1. Git checks
2. Commit creation
3. Push to remote branch
4. Optional GitHub repository creation (via GitHub CLI)
5. Optional deployment hints (for Streamlit flow)

## Included file

- `github-deploy-skill.ps1`

## Parameters

- `-CommitMessage` (required): commit message text
- `-Repo` (optional): GitHub repository in `owner/repo` format
- `-Branch` (optional): target branch, default `main`
- `-CreateRepo` (optional switch): create repo with `gh` if missing
- `-SkipDeployHint` (optional switch): do not print deployment hint

## Usage

From any Git project folder:

```powershell
powershell -ExecutionPolicy Bypass -File .\github-deploy-skill.ps1 -CommitMessage "feat: update" -Repo "owner/repo" -Branch "main"
```

Create repository automatically:

```powershell
powershell -ExecutionPolicy Bypass -File .\github-deploy-skill.ps1 -CommitMessage "init" -Repo "owner/new-repo" -CreateRepo
```

## Expected output

- Success: commit and push completed
- Failure: explicit error with reason (missing command, auth, push/network, remote config)

## Requirements

- Git installed and available in PATH
- Network access to remote Git host
- If `-CreateRepo` is used: GitHub CLI (`gh`) installed and authenticated

## Notes

- Works with repositories that do not yet have a first commit.
- If `origin` does not exist, pass `-Repo` and the script will add it automatically.

Overview

This skill automates committing and pushing local project changes to GitHub from Windows using a reusable PowerShell script. It can create a remote repository via the GitHub CLI if needed and prints optional deployment hints for simple hosting flows like Streamlit. The result is a single command to handle git checks, commits, remote setup, and push operations reliably.

How this skill works

The script inspects the current folder for a git repository, stages changes, creates a commit with the provided message, and pushes to the specified branch. If a remote named origin is missing and an owner/repo is provided, it can call the GitHub CLI to create the repo and add the remote. It reports clear success or explicit error reasons (missing tools, auth issues, network or push failures).

When to use it

  • You need a quick, repeatable way to commit and push changes from Windows PowerShell.
  • You want to initialize and push a repository that has no commits yet.
  • You prefer a single command that can optionally create the remote repo via gh.
  • You want deployment guidance after pushing (e.g., Streamlit hints).
  • You need explicit failure messages for CI or local automation scripts.

Best practices

  • Install and authenticate GitHub CLI (gh) before using -CreateRepo to avoid interruptions.
  • Run from the project root inside a git working tree to ensure correct path handling.
  • Use clear, conventional commit messages passed via -CommitMessage for traceable history.
  • Test network connectivity and git authentication (ssh/key or https token) before automated runs.
  • Use the -SkipDeployHint flag in CI to suppress interactive guidance outputs.

Example use cases

  • Commit and push regular code updates with: powershell -ExecutionPolicy Bypass -File .\github-deploy-skill.ps1 -CommitMessage "feat: update" -Repo "owner/repo" -Branch "main".
  • Initialize a new project and create the remote with: powershell -ExecutionPolicy Bypass -File .\github-deploy-skill.ps1 -CommitMessage "init" -Repo "owner/new-repo" -CreateRepo.
  • Push to a specific branch after local changes: include -Branch "develop" to target non-main branches.
  • Use in a development workflow that provides a deployment hint for Streamlit apps after a successful push.
  • Run locally to quickly back up a working directory to a GitHub repo when manual git commands are inconvenient.

FAQ

What tools must be installed to use this skill?

Git must be in PATH. If using -CreateRepo, install and authenticate the GitHub CLI (gh).

Can it push a repository with no commits yet?

Yes. The script handles repositories that lack an initial commit and will add origin and push if you provide -Repo.