# GitHub Actions

You can prepare and deploy the gateway from CI.

## Repository layout

```
.github/
  workflows/
    deploy-serverless-api-gateway.yml
api-config.json
wrangler.toml
```

## Example workflow

```yaml
name: Deploy Serverless API Gateway

on:
  push:
    branches: [main]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Prepare gateway worker
        uses: irensaltali/serverlessapigateway-action@main
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          configJson: ./api-config.json
          wranglerToml: ./wrangler.toml
          versionTag: v1.0.1

      - name: Deploy to Cloudflare Workers
        uses: cloudflare/wrangler-action@v3
        with:
          apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
          workingDirectory: worker
```

### Notes

* Store your `CLOUDFLARE_API_TOKEN` as a GitHub Actions secret. Never commit API tokens to the repository.
* The `configJson` parameter should point to your [API configuration file](/configuration/overview.md), which defines routing, CORS, authorizer, and server settings.
* For local development and manual deploys, see the [Wrangler deployment guide](/deployment/wrangler.md).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.serverlessapigateway.com/deployment/github-actions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
