Hosting operations3 minutes to read

Deploy a bot from GitHub Actions after tests pass

Queue a Bothosting Git deployment from GitHub Actions, then verify that the active commit matches the commit your workflow tested.

Connect the branch that CI tests

GitHub Actions can run your tests and then request a deploy through the Bothosting REST API. The deployment uses the latest commit on its saved Git branch. Have the workflow check the active Git revision before it reports a successful release.

For this workflow, create a bot or app deployment with a supported Git runtime and link main using the manual connection in Deploy. Leave the generated push webhook unregistered so the workflow controls when a release starts. An enabled GitHub App connection delivers pushes directly. See the GitHub deployment setup for the repository, branch and private checkout credential.

In Account → AI agents, create a token limited to this deployment and grant read and deploy. In your GitHub repository or deployment environment, save it as the BH_API_TOKEN secret. Set BH_PORTAL_URL to the HTTPS dashboard origin, BH_DEPLOYMENT_ID to the public ID from bothosting list and BH_DEPLOYMENT_NAME to its exact displayed name. Save these three nonsecret values as Actions variables. GitHub Actions secret settings.

Queue a deploy and wait for the tested commit

Add this step after successful tests in a trusted job that runs on pushes to main. The job needs Bash, curl and jq. Change both the step condition and the linked branch if you release from a different branch.

GitHub Actions step for a linked deployment
- name: Deploy tested revision
  if: github.ref == 'refs/heads/main'
  shell: bash
  env:
    BH_PORTAL_URL: ${{ vars.BH_PORTAL_URL }}
    BH_DEPLOYMENT_ID: ${{ vars.BH_DEPLOYMENT_ID }}
    BH_DEPLOYMENT_NAME: ${{ vars.BH_DEPLOYMENT_NAME }}
    BH_API_TOKEN: ${{ secrets.BH_API_TOKEN }}
  run: |
    set -euo pipefail
    target="$BH_PORTAL_URL/api/v1/deployments/$BH_DEPLOYMENT_ID"
    request() {
      printf 'Authorization: Bearer %s\n' "$BH_API_TOKEN" |
        curl --proto '=https' --silent --show-error --fail-with-body --max-time 30 --header @- "$@"
    }

    body=$(jq -nc --arg name "$BH_DEPLOYMENT_NAME" '{confirm: $name}')
    request --json "$body" "$target/deploy" |
      jq -e 'if .accepted and .status == "queued" then true else error(.error // "Expected a queued Git deploy") end'

    for attempt in {1..60}; do
      revision=$(request "$target/git/revisions")
      if jq -e '.pending == false' <<< "$revision" >/dev/null; then
        jq -e --arg sha "$GITHUB_SHA" '.active.sha == $sha' <<< "$revision"
        exit 0
      fi
      sleep 5
    done

    echo "Timed out waiting for the Git deployment" >&2
    exit 1

A queued response means Bothosting accepted the request. The active SHA establishes which commit became healthy. Allow a longer wait if your normal builds need more time.

Check a failed or superseded run

If the branch advances between tests and the deploy request, Bothosting can pick up a newer commit. The SHA check fails the workflow in that case. Open Deploy → Recent deploys and compare the recorded commit with the workflow’s commit. Use a release branch you update only with tested changes if concurrent pushes frequently overtake the workflow.

If the request times out, look in Recent deploys before submitting it again. For a commit that failed checkout, build or startup, follow the deployment log guide. The API reference lists the deploy and Git revision operations.