Last reviewed: November 18, 2026 (UTC and Asia/Shanghai).

Run a CometAPI GitHub Actions smoke test through a dedicated workflow_dispatch workflow. Put the credential in a restricted GitHub environment, require an explicit live-call checkbox, and send one fixed, non-streaming chat request. Accept the result only when HTTP succeeds and the response contains one completed assistant text answer. Keep generated text and credentials out of the job log.

The workflow below gives a maintainer a deliberate account-backed check after changing credentials or reviewing an integration. It contains no repository checkout or dependency installation. Ordinary client tests can continue using the site’s offline MockAgent suite . A live check answers a different question: whether this runner and credential can obtain an acceptable response from the reviewed endpoint now.

Restrict the environment before adding its key

Use a repository you administer, GitHub Actions access, and a CometAPI key authorized for your selected model. This example assumes the reviewed default branch is named main. Change both the workflow condition and the environment rule if your default branch has another name.

In Settings → Environments, create cometapi-smoke. Under deployment branch rules, choose Selected branches and tags and add a Branch rule for exactly main. Leave other branches and tags unapproved. Where your GitHub plan supports it, add a required reviewer and enable Prevent self-review. GitHub’s environment guide explains these controls and when environment secrets become accessible.

Check feature availability before storing the credential. GitHub documents different environment and protection-rule availability for public and private repositories and across plans. This procedure requires the branch restriction; reviewer approval is an additional control when available. Do not assume that writing an environment name in YAML creates those protections.

Add COMETAPI_KEY under that environment’s Environment secrets. Avoid defining the same key at repository or organization scope for this workflow: a second copy makes it harder to tell which boundary actually protects it. Protect changes to main with your normal review process, including edits to workflow files. Anyone authorized to change code that receives a secret remains part of its trust boundary.

GitHub’s secrets guide documents passing a secret through env and recommends avoiding secret values in process arguments. Here the shell passes the Authorization header to curl over standard input. Do not enable shell tracing or add commands that print the environment.

Add the manually dispatched workflow

Save this complete file as .github/workflows/cometapi-smoke.yml through your normal review process. The runner needs Bash, jq, and curl 8.4.0 or newer; the step checks the tools and curl version before sending. It uses ubuntu-24.04, but the hosted image can change, so its tool check is part of each run.

The request follows the current CometAPI Chat Completions reference : HTTPS on api.cometapi.com, path /v1/chat/completions, Bearer authentication, and a JSON body. The model and reasoning setting match its basic chat example. Confirm your account can use that model before dispatching. If you change models, review the replacement’s endpoint and parameter support first.

name: CometAPI manual smoke

on:
  workflow_dispatch:
    inputs:
      confirm_live_call:
        description: Send one potentially billable chat request
        required: true
        default: false
        type: boolean

permissions: {}

concurrency:
  group: cometapi-manual-smoke
  cancel-in-progress: false

jobs:
  smoke:
    if: ${{ inputs.confirm_live_call && github.ref == 'refs/heads/main' }}
    runs-on: ubuntu-24.04
    environment: cometapi-smoke
    timeout-minutes: 3
    steps:
      - name: Check one completed assistant answer
        shell: bash
        env:
          COMETAPI_KEY: ${{ secrets.COMETAPI_KEY }}
        run: |
          set +x
          set -euo pipefail
          for tool in curl jq; do
            if ! command -v "$tool" >/dev/null 2>&1; then
              printf '::error::Required tool %s is missing\n' "$tool"
              exit 1
            fi
          done
          curl_version=$(curl --version)
          curl_version=${curl_version#curl }
          curl_version=${curl_version%% *}
          if ! printf '%s\n' 8.4.0 "$curl_version" | sort -V -C; then
            printf '::error::curl 8.4.0 or newer is required\n'
            exit 1
          fi
          if [[ -z "${COMETAPI_KEY:-}" ||
                "$COMETAPI_KEY" == *$'\r'* ||
                "$COMETAPI_KEY" == *$'\n'* ]]; then
            printf '::error::Missing or malformed COMETAPI_KEY\n'
            exit 1
          fi

          umask 077
          work=$(mktemp -d "$RUNNER_TEMP/cometapi-smoke.XXXXXX")
          trap 'rm -rf -- "$work"' EXIT
          cat >"$work/request.json" <<'JSON'
          {
            "model": "gpt-6-astra",
            "messages": [{
              "role": "user",
              "content": "Explain an API smoke test in one short sentence."
            }],
            "reasoning_effort": "low",
            "max_completion_tokens": 2048,
            "stream": false
          }
          JSON

          curl_code=0
          http_status=$(
            printf 'Authorization: Bearer %s\n' "$COMETAPI_KEY" |
            curl --disable --silent --show-error \
              --proto '=https' --retry 0 \
              --connect-timeout 10 --max-time 60 \
              --max-filesize 1048576 \
              --url 'https://api.cometapi.com/v1/chat/completions' \
              --header @- --header 'Content-Type: application/json' \
              --data-binary @"$work/request.json" \
              --output "$work/response.json" \
              --write-out '%{http_code}'
          ) || curl_code=$?
          if (( curl_code != 0 )); then
            printf '::error::curl failed (exit %s); remote outcome may be unknown\n' "$curl_code"
            exit 1
          fi
          if [[ "$http_status" != 200 ]]; then
            printf '::error::Chat endpoint returned HTTP %s\n' "$http_status"
            exit 1
          fi

          if ! jq -e -s '
            length == 1 and
            (.[0] |
              type == "object" and
              .object == "chat.completion" and
              (.choices | type == "array" and length == 1) and
              (.choices[0] |
                .finish_reason == "stop" and
                (.message |
                  .role == "assistant" and
                  (.content | type == "string" and test("\\S")) and
                  .refusal == null and
                  .tool_calls == null and
                  .function_call == null)))
          ' "$work/response.json" >/dev/null 2>&1; then
            printf '::error::Response did not satisfy the completed-text check\n'
            exit 1
          fi
          printf '::notice::One completed assistant text response accepted\n'

The GitHub workflow syntax reference documents Boolean dispatch inputs, job conditions, token permissions, concurrency, and job timeouts. permissions: {} removes the available GITHUB_TOKEN permissions; the external API uses its separate environment secret. The condition allows the job only when the checkbox is selected and the dispatched ref is main. Neither setting replaces the environment’s branch rule.

The constant concurrency group limits simultaneous runs using that group in this repository. cancel-in-progress: false avoids automatically canceling an active check when another run arrives. It does not impose a daily call limit, prevent deliberate reruns, or coordinate checks in other repositories.

Read the transport and completion limits correctly

The curl manual documents the command’s transport controls. --disable is its first argument so an ambient curl configuration cannot silently add options. --retry 0 adds no automatic retries. The command does not enable redirect following. The local choices are a 10-second connection timeout, a 60-second transfer deadline, and a 1 MiB download ceiling. The version check matters because limiting downloads of initially unknown size requires curl 8.4.0 or newer.

Those are tutorial policy choices, not CometAPI service guarantees. A transfer deadline or byte-limit abort can leave the remote generation’s outcome unconfirmed. Job cancellation has the same uncertainty. Before rerunning a failed check, inspect its run and whatever account-side evidence is available.

The 2,048-token generation ceiling includes reasoning and visible output for the documented example model. It is not a dollar budget or a guarantee that the answer will finish. A length result deliberately fails the acceptance rule rather than being relabeled as successful text.

The jq manual documents --slurp and --exit-status. Slurping lets the filter require exactly one JSON document; otherwise a series of JSON documents could be processed separately. The application rule then requires one choice, assistant role, a stop finish reason, nonblank string content, and no refusal or function/tool call. Other valid response outcomes need different application handling. The filter accepts additional fields so harmless metadata additions do not require a rewrite.

The script writes its request and response inside a private temporary directory and removes that directory on ordinary exit. It uploads no response artifact and prints no generated answer. This limits routine retention; cleanup is not guaranteed after a forced runner termination. Keep the prompt synthetic, and use a GitHub-hosted runner for this example rather than assuming a shared persistent runner has equivalent isolation.

Dispatch once and inspect the job result

GitHub’s manual-run guide requires the workflow to exist on the default branch before manual dispatch and requires repository write access. After the reviewed file is on main, open Actions → CometAPI manual smoke → Run workflow. Select main, select the live-call checkbox, and dispatch once. Approve the environment job if you configured a reviewer.

Inspect the smoke job itself. An unchecked box or a different branch makes the job skipped; a skipped workflow is not evidence that the API worked. A completed check should end with the fixed notice One completed assistant text response accepted. It does not promise particular wording or validate the answer’s factual quality.

ObservationMeaning and next action
Waiting for environment approvalReview the workflow ref and requested check before approving. No runner-side API call has occurred yet.
Job skippedCheck the Boolean input and branch selection. Do not record an API success.
Missing or malformed keyPopulate the intended environment secret; the step stops before invoking the chat transfer.
HTTP 401 or 403Investigate credential and access configuration privately before another dispatch.
Other non-200 HTTP resultRecord the status and inspect current request/account evidence; the check does not retry.
Nonzero curl exitInvestigate network, deadline, or size failure. The server may already have accepted the request.
Completed-text check failsInvestigate JSON shape, finish reason, refusal, or unsupported output. HTTP success alone did not pass.

Retain the run URL, commit SHA, selected ref, observation time, and result category in your integration notes. Keep the key, resolved Authorization header, prompt dumps, and response files out of shared logs. If you need to inspect a failure body, reproduce it in a controlled private client using the site’s Bruno request tutorial , with a synthetic prompt and another deliberate request.

Verification scope and the first useful run

The extracted Bash step passed 28 local fixture cases with jq 1.7 and a stubbed curl command. Two additional tests ran the exact step with an isolated PATH: curl present with jq absent, and jq present with curl absent. Each missing-tool case exited with a specific preflight error before invoking either tool or creating the request directory. The harness checked the destination, JSON body, transfer options, header input, single transfer invocation, private file permissions, cleanup, and absence of fixture credentials or answer text in output. Completed text and extra metadata passed; HTTP errors, redirects, malformed or multiple JSON documents, truncation, blank content, refusals, tool calls, and synthetic transport failures failed as intended. Missing or malformed keys and an old curl version stopped before a transfer invocation.

These checks exercise local control flow and response acceptance. No authenticated CometAPI request or GitHub-hosted workflow run was performed for this article. The stub does not verify real TLS, curl’s network limits, GitHub expression evaluation, environment rules, or approvals. Verify those in your own repository.

Start by reviewing the YAML and environment restriction together. Run once with the checkbox clear and confirm the job is skipped. Then dispatch one authorized live check with the checkbox selected. Record its actual result before adding any scheduling or deployment dependency.

Need account access for that deliberate check? Start with CometAPI , confirm the selected model and request contract, and return to the same workflow. Keep ordinary pull-request testing on synthetic responses so a source change does not automatically send this live request.

Sources checked

Seven distinct primary public references returned HTTP 200 on November 18, 2026 UTC. These maintained technical references support an evergreen integration task; this article does not report a product launch. Account access, repository settings, and the eventual live result require the reader’s own verification.