-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (49 loc) · 1.83 KB
/
Copy pathpublish-context7.yml
File metadata and controls
53 lines (49 loc) · 1.83 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
name: Publish to Context7
# Fires after a refresh PR merges and the published surface (polished docs
# or skill) actually changed. Tells Context7 to re-index our library so
# updates land in agent results without waiting for the scheduled crawl.
#
# STUB: the POST below targets a placeholder endpoint. The real reindex
# URL and the payload shape are pending confirmation from Context7
# (Lauren). The CONTEXT7_API_KEY repo secret is not provisioned yet —
# until it is, the curl call will fail and the job will exit non-zero.
# That's intentional so a missing secret is loud rather than silent.
on:
push:
branches: [main]
paths:
- polished/**
- iterable-android/**
- context7.json
workflow_dispatch:
permissions:
contents: read
jobs:
publish:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Reindex Context7 library
env:
CONTEXT7_API_KEY: ${{ secrets.CONTEXT7_API_KEY }}
# TODO: replace once Lauren / Context7 confirm the endpoint shape.
CONTEXT7_REINDEX_URL: https://context7.com/api/v1/libraries/iterable/sdks/reindex
run: |
set -euo pipefail
if [[ -z "${CONTEXT7_API_KEY:-}" ]]; then
echo "::error::CONTEXT7_API_KEY secret is not set on this repo."
echo "Provision the secret once Context7 issues a token, then re-run."
exit 1
fi
echo "Triggering Context7 reindex for commit ${GITHUB_SHA}"
curl --fail-with-body --silent --show-error \
-X POST "${CONTEXT7_REINDEX_URL}" \
-H "Authorization: Bearer ${CONTEXT7_API_KEY}" \
-H "Content-Type: application/json" \
-d "$(cat <<EOF
{
"ref": "${GITHUB_SHA}",
"source": "github.com/${GITHUB_REPOSITORY}"
}
EOF
)"