name: push-main description: "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."
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/discobotas the canonical upstream repository. - Push only to the canonical repository's
mainbranch. - Do not assume the remote is named
originorupstream; discover it fromgit remote -v. - Use
ghfor 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 listto discover run IDs, thengh run watch --exit-statusto 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
HEADon upstreammainhas all relevant GitHub Actions runs completed successfully. - If CI fails, inspect the failed run with
gh run viewand, 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 newHEAD. - 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 -vand select the remote whose URL points toobot-platform/discobot. - Run
gh auth status. - Fetch the canonical refs:
git fetch <remote> maingit fetch <remote> --tags
- Verify the current branch and upstream state:
git branch --show-currentgit rev-parse HEADgit rev-parse <remote>/main
2. Commit the current content when needed
- If the working tree or index is dirty, inspect all changes:
git status --shortgit diffgit 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,
.envsecrets, 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
HEADto canonicalmain:git push <remote> HEAD:main
- Fetch again and verify:
git fetch <remote> maingit rev-parse HEADgit rev-parse <remote>/main
- Do not continue until local
HEADmatches<remote>/main.
4. Watch CI for the pushed commit
- Resolve the pushed SHA:
git rev-parse HEAD
- 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>andgh run view <run-id> --log-failed.
- If active, run
- 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 viewand failed logs. - Read the relevant code before editing.
- Make the smallest scoped fix.
- Run the smallest meaningful local validation first, for example:
pnpm checkpnpm testpnpm cipnpm run cigo 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/discobothasmainat the localHEAD, - 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.