Push Main and Drive CI Green
Push the current repository content to the canonical obot-platform/discobot
main branch, then watch GitHub Actions with gh run watch --exit-status.
If CI fails, diagnose, fix, commit, push, and watch again. Continue until the
latest pushed main commit has passing CI.
Treat invoking /push-main as authorization to perform the normal end-to-end
push-and-fix loop on obot-platform/discobot without pausing for routine
confirmation. Keep the user informed with concise progress updates, but do not
stop on the happy path.
Core Rules
- Treat
obot-platform/discobot as the canonical upstream repository.
- Push only to the canonical repository's
main branch.
- Do not assume the remote is named
origin or upstream; discover it from
git remote -v.
- Use
gh for GitHub Actions inspection and waiting.
- When a workflow run is queued, waiting, requested, or in progress, wait with:
gh run watch <run-id> --exit-status.
- Avoid polling as the primary wait mechanism. Use
gh run list to discover
run IDs, then gh run watch --exit-status to block until completion.
- Re-list runs after each watch because new runs can appear for the same commit
after the first run starts.
- Do not finish until the latest pushed
HEAD on upstream main has all
relevant GitHub Actions runs completed successfully.
- If CI fails, inspect the failed run with
gh run view and, when useful,
gh run view --log-failed; fix the issue locally; run the smallest relevant
local validation; commit; push; and restart CI verification for the new
HEAD.
- Ask the user only when blocked by missing permissions/authentication,
ambiguous CI failures, a risky or broad remediation, secrets, a non-fast-
forward push, or an action that would rewrite published history.
Procedure
1. Confirm repository and authentication
- Run
git status --short --branch.
- Run
git remote -v and select the remote whose URL points to
obot-platform/discobot.
- Run
gh auth status.
- Fetch the canonical refs:
git fetch <remote> main
git fetch <remote> --tags
- Verify the current branch and upstream state:
git branch --show-current
git rev-parse HEAD
git rev-parse <remote>/main
2. Commit the current content when needed
- If the working tree or index is dirty, inspect all changes:
git status --short
git diff
git diff --cached
- Organize changes into the smallest sensible set of conventional commits.
- Include a commit body after a blank line.
- Avoid committing generated binaries, credentials,
.env secrets, or
unrelated temporary artifacts.
- If the requested scope is clear, commit without asking. If changes are
ambiguous or include suspicious files, ask the user before committing.
- If there are no local changes, push the current
HEAD.
3. Push to upstream main
- Rebase/merge only if it can be done safely and without rewriting published
history. Ask before any non-trivial conflict resolution.
- Push the local
HEAD to canonical main:
git push <remote> HEAD:main
- Fetch again and verify:
git fetch <remote> main
git rev-parse HEAD
git rev-parse <remote>/main
- Do not continue until local
HEAD matches <remote>/main.
4. Watch CI for the pushed commit
- Resolve the pushed SHA:
- Discover workflow runs for that SHA:
gh run list --commit <sha>
- For each relevant run:
- If active, run
gh run watch <run-id> --exit-status.
- If failed, inspect with
gh run view <run-id> and
gh run view <run-id> --log-failed.
- After each watched run completes, run
gh run list --commit <sha> again.
- Treat CI as passing only when every relevant run for the pushed SHA has
conclusion
success.
- If no run appears immediately after pushing, wait briefly and re-list a small
number of times only to discover the run ID. As soon as a run ID exists,
switch to
gh run watch --exit-status.
5. Fix failures and repeat
When any CI run fails:
- Identify the failing job/step from
gh run view and failed logs.
- Read the relevant code before editing.
- Make the smallest scoped fix.
- Run the smallest meaningful local validation first, for example:
pnpm check
pnpm test
pnpm ci
pnpm run ci
go test ./... in the affected module
- Commit the fix with a conventional commit message.
- Push again with
git push <remote> HEAD:main.
- Restart CI verification from step 4 for the new
HEAD.
Expected Commands
Use commands along these lines:
git status --short --branch
git remote -v
gh auth status
git fetch <remote> main
git fetch <remote> --tags
git rev-parse HEAD
git rev-parse <remote>/main
git diff
git diff --cached
git add <paths>
git commit -m '<subject>' -m '<body>'
git push <remote> HEAD:main
gh run list --commit <sha>
gh run watch <run-id> --exit-status
gh run view <run-id>
gh run view <run-id> --log-failed
Completion Criteria
The skill is complete only when:
- the canonical remote for
obot-platform/discobot has main at the local
HEAD,
- all relevant GitHub Actions runs for that exact commit have completed, and
- every relevant run concluded successfully.
End with a concise summary that includes:
- the pushed commit SHA,
- the remote used,
- the successful CI run IDs,
- what changed during the push-main run, and
- why each change was made, including any CI failure fixes.
1---2name: push-main3description: Push the current content to obot-platform/discobot main, watch GitHub Actions with gh run watch, fix CI failures, and repeat until main CI passes.4---56# Push Main and Drive CI Green78Push the current repository content to the canonical `obot-platform/discobot`9`main` branch, then watch GitHub Actions with `gh run watch --exit-status`.10If CI fails, diagnose, fix, commit, push, and watch again. Continue until the11latest pushed `main` commit has passing CI.1213Treat invoking `/push-main` as authorization to perform the normal end-to-end14push-and-fix loop on `obot-platform/discobot` without pausing for routine15confirmation. Keep the user informed with concise progress updates, but do not16stop on the happy path.1718## Core Rules1920- Treat `obot-platform/discobot` as the canonical upstream repository.21- Push only to the canonical repository's `main` branch.22- Do not assume the remote is named `origin` or `upstream`; discover it from23 `git remote -v`.24- Use `gh` for GitHub Actions inspection and waiting.25- When a workflow run is queued, waiting, requested, or in progress, wait with:26 `gh run watch <run-id> --exit-status`.27- Avoid polling as the primary wait mechanism. Use `gh run list` to discover28 run IDs, then `gh run watch --exit-status` to block until completion.29- Re-list runs after each watch because new runs can appear for the same commit30 after the first run starts.31- Do not finish until the latest pushed `HEAD` on upstream `main` has all32 relevant GitHub Actions runs completed successfully.33- If CI fails, inspect the failed run with `gh run view` and, when useful,34 `gh run view --log-failed`; fix the issue locally; run the smallest relevant35 local validation; commit; push; and restart CI verification for the new36 `HEAD`.37- Ask the user only when blocked by missing permissions/authentication,38 ambiguous CI failures, a risky or broad remediation, secrets, a non-fast-39 forward push, or an action that would rewrite published history.4041## Procedure4243### 1. Confirm repository and authentication44451. Run `git status --short --branch`.462. Run `git remote -v` and select the remote whose URL points to47 `obot-platform/discobot`.483. Run `gh auth status`.494. Fetch the canonical refs:50 - `git fetch <remote> main`51 - `git fetch <remote> --tags`525. Verify the current branch and upstream state:53 - `git branch --show-current`54 - `git rev-parse HEAD`55 - `git rev-parse <remote>/main`5657### 2. Commit the current content when needed58591. If the working tree or index is dirty, inspect all changes:60 - `git status --short`61 - `git diff`62 - `git diff --cached`632. Organize changes into the smallest sensible set of conventional commits.64 - Include a commit body after a blank line.65 - Avoid committing generated binaries, credentials, `.env` secrets, or66 unrelated temporary artifacts.673. If the requested scope is clear, commit without asking. If changes are68 ambiguous or include suspicious files, ask the user before committing.694. If there are no local changes, push the current `HEAD`.7071### 3. Push to upstream main72731. Rebase/merge only if it can be done safely and without rewriting published74 history. Ask before any non-trivial conflict resolution.752. Push the local `HEAD` to canonical `main`:76 - `git push <remote> HEAD:main`773. Fetch again and verify:78 - `git fetch <remote> main`79 - `git rev-parse HEAD`80 - `git rev-parse <remote>/main`814. Do not continue until local `HEAD` matches `<remote>/main`.8283### 4. Watch CI for the pushed commit84851. Resolve the pushed SHA:86 - `git rev-parse HEAD`872. Discover workflow runs for that SHA:88 - `gh run list --commit <sha>`893. For each relevant run:90 - If active, run `gh run watch <run-id> --exit-status`.91 - If failed, inspect with `gh run view <run-id>` and92 `gh run view <run-id> --log-failed`.934. After each watched run completes, run `gh run list --commit <sha>` again.945. Treat CI as passing only when every relevant run for the pushed SHA has95 conclusion `success`.966. If no run appears immediately after pushing, wait briefly and re-list a small97 number of times only to discover the run ID. As soon as a run ID exists,98 switch to `gh run watch --exit-status`.99100### 5. Fix failures and repeat101102When any CI run fails:1031041. Identify the failing job/step from `gh run view` and failed logs.1052. Read the relevant code before editing.1063. Make the smallest scoped fix.1074. Run the smallest meaningful local validation first, for example:108 - `pnpm check`109 - `pnpm test`110 - `pnpm ci`111 - `pnpm run ci`112 - `go test ./...` in the affected module1135. Commit the fix with a conventional commit message.1146. Push again with `git push <remote> HEAD:main`.1157. Restart CI verification from step 4 for the new `HEAD`.116117## Expected Commands118119Use commands along these lines:120121```bash122git status --short --branch123git remote -v124gh auth status125git fetch <remote> main126git fetch <remote> --tags127git rev-parse HEAD128git rev-parse <remote>/main129git diff130git diff --cached131git add <paths>132git commit -m '<subject>' -m '<body>'133git push <remote> HEAD:main134gh run list --commit <sha>135gh run watch <run-id> --exit-status136gh run view <run-id>137gh run view <run-id> --log-failed138```139140## Completion Criteria141142The skill is complete only when:143144- the canonical remote for `obot-platform/discobot` has `main` at the local145 `HEAD`,146- all relevant GitHub Actions runs for that exact commit have completed, and147- every relevant run concluded successfully.148149End with a concise summary that includes:150151- the pushed commit SHA,152- the remote used,153- the successful CI run IDs,154- what changed during the push-main run, and155- why each change was made, including any CI failure fixes.