Repository navigation
Expand file tree
/
Copy pathgithub-actions.yml
More file actions
69 lines (65 loc) · 2.79 KB
/
Copy pathgithub-actions.yml
File metadata and controls
69 lines (65 loc) · 2.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# Deploy DocsGPT sources and agents from a repository, then smoke-test them.
# Copy to .github/workflows/docsgpt.yml.
#
# Secrets / variables:
# DOCSGPT_TOKEN personal access token (Settings -> Access Tokens) with the
# scopes agents:write, sources:write and chat:run
# DOCSGPT_URL base URL of your deployment (repository variable)
name: DocsGPT
on:
pull_request:
paths: ["agents/**", "docs/**"]
push:
branches: [main]
paths: ["agents/**", "docs/**"]
env:
DOCSGPT_TOKEN: ${{ secrets.DOCSGPT_TOKEN }}
DOCSGPT_URL: ${{ vars.DOCSGPT_URL }}
DOCSGPT_NO_UPDATE_CHECK: "1"
jobs:
plan:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install docsgpt-cli
run: |
curl -fsSL -o docsgpt-cli.tar.gz \
https://github.com/arc53/DocsGPT-cli/releases/latest/download/docsgpt-cli_linux_amd64.tar.gz
tar -xzf docsgpt-cli.tar.gz docsgpt-cli && sudo mv docsgpt-cli /usr/local/bin/
- run: docsgpt-cli whoami
# Exits 1 when a reference is missing/unavailable, 2 on invalid YAML.
- run: docsgpt-cli agents plan -f agents/
deploy:
if: github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install docsgpt-cli
run: |
curl -fsSL -o docsgpt-cli.tar.gz \
https://github.com/arc53/DocsGPT-cli/releases/latest/download/docsgpt-cli_linux_amd64.tar.gz
tar -xzf docsgpt-cli.tar.gz docsgpt-cli && sudo mv docsgpt-cli /usr/local/bin/
# Safe to retry: the Idempotency-Key is derived from --name and the file
# contents, so a re-run of the same commit does not ingest twice.
# --replace deletes the older "Product docs" once the new one is ingested.
# Without it every push leaves another source with the same name and the
# agents below stay bound to the oldest one.
- name: Upload documentation
# Keyed by commit: a re-run of this commit is deduplicated, while a revert
# to older content is a new commit and is ingested again (the default
# content-derived key would repeat and be deduplicated by the server).
run: >
docsgpt-cli sources upload docs/*.md --name "Product docs"
--wait --replace --timeout 15m
--idempotency-key "docs-${{ github.sha }}"
# Must run after the upload: it re-points agents that name the source.
- name: Apply agents
run: docsgpt-cli agents apply -f agents/
- name: Smoke-test the agent
run: docsgpt-cli bench ./bench --target stream --agent-id "${{ vars.DOCSGPT_AGENT_ID }}" --junit bench.xml --run-tag ci
- uses: actions/upload-artifact@v4
if: always()
with:
name: bench-report
path: bench.xml