# GitHub Workflow Example

The following is a sample workflow. It assumes all items to push are in `/final` by object type.

It also assumes the [rule service script](/orl/publish/orl-rule-service-api/script.md) is in the `./bin` directory.

```yaml
name: Publish Rules
permissions:
  contents: read

on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main
  workflow_dispatch: {}

env:
  IMAGE: gombocai/orl:latest
  RULE_SERVICE_URL: https://rules.app.gomboc.ai
  RULE_SERVICE_TOKEN: ${{ secrets.RULE_SERVICE_TOKEN}}

jobs:
  push-rules:
    name: Push Rules to Rules Service
    runs-on: ubuntu-latest

    steps:
      - name: Checkout Code
        uses: actions/checkout@v4
        with:
          fetch-depth: 0
          submodules: true

      - name: Pull Docker Image
        run: docker pull ${{ env.IMAGE }}

      - name: Validate Rulespace
        run: |
          docker run --rm \
            -v ${{ github.workspace }}:/workspace \
            -w /workspace \
            ${{ env.IMAGE }} \
            walk rulespace ./final/rules

      - name: Update Channels and Classifications
        if: github.event_name != 'pull_request'
        run: |
          ./bin/rules-service upsert channels ./final/channels
          ./bin/rules-service upsert classifications ./final/classifications

      - name: Push Rules to Rules Service
        if: github.event_name != 'pull_request'
        env:
          RULE_SERVICE_URL: ${{ env.RULE_SERVICE_URL }}
          RULE_SERVICE_TOKEN: ${{ env.RULE_SERVICE_TOKEN }}
        run: |
          docker run --rm \
            -v ${{ github.workspace }}:/workspace \
            -w /workspace \
            -e RULE_SERVICE_URL=$RULE_SERVICE_URL \
            -e RULE_SERVICE_TOKEN=$RULE_SERVICE_TOKEN \
            ${{ env.IMAGE }} \
            rules push --url "$RULE_SERVICE_URL" --token "$RULE_SERVICE_TOKEN" ./final/rules

      - name: Delete Old Channels, Classifications, and Rules
        if: github.event_name != 'pull_request'
        run: |
          ./bin/rules-service delete channels ./final/channels
          ./bin/rules-service delete classifications ./final/classifications
          ./bin/rules-service delete rules ./final/rules
```


---

# 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.gomboc.ai/orl/publish/github-workflow.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.
