mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-11-01 21:35:25 +08:00
Merge remote-tracking branch 'origin/master' into ci/daily-endurance
# Conflicts: # tools/regression_ci.py
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
name: Refresh Context7 docs
|
||||
|
||||
# Re-index the public documentation in Context7 whenever the English docs change.
|
||||
# Requires a repository secret CONTEXT7_API_KEY (context7.com/dashboard) and a
|
||||
# Context7 library registered for this repository; both are one-time owner steps.
|
||||
# Until the secret exists every run is a no-op instead of a failure.
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
paths:
|
||||
- "docs/en/**"
|
||||
- "context7.json"
|
||||
- ".github/workflows/context7-refresh.yml"
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: context7-refresh
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
refresh:
|
||||
name: Refresh Context7 library
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 5
|
||||
env:
|
||||
CONTEXT7_API_KEY: ${{ secrets.CONTEXT7_API_KEY }}
|
||||
CONTEXT7_LIBRARY: /langbot-app/langbot
|
||||
steps:
|
||||
- name: Skip when the Context7 API key is not configured
|
||||
if: env.CONTEXT7_API_KEY == ''
|
||||
run: |
|
||||
echo "CONTEXT7_API_KEY is not configured; skipping the Context7 refresh."
|
||||
echo "Add the secret and register the library, then re-run this workflow."
|
||||
|
||||
- name: Trigger Context7 refresh
|
||||
if: env.CONTEXT7_API_KEY != ''
|
||||
run: |
|
||||
set -euo pipefail
|
||||
body=$(printf '{"libraryName":"%s"}' "$CONTEXT7_LIBRARY")
|
||||
code=$(curl -sS -o "$RUNNER_TEMP/refresh.json" -w '%{http_code}' \
|
||||
-X POST https://context7.com/api/v1/refresh \
|
||||
-H 'Content-Type: application/json' \
|
||||
-H "Authorization: Bearer ${CONTEXT7_API_KEY}" \
|
||||
-d "$body")
|
||||
cat "$RUNNER_TEMP/refresh.json"
|
||||
if [ "$code" -lt 200 ] || [ "$code" -ge 300 ]; then
|
||||
echo "Context7 refresh failed with HTTP $code" >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "Requested a refresh of ${CONTEXT7_LIBRARY}."
|
||||
@@ -14,7 +14,7 @@ concurrency:
|
||||
|
||||
jobs:
|
||||
sync:
|
||||
if: github.repository == 'langbot-app/LangBot' && github.ref == 'refs/heads/master' && vars.DOCS_MIRROR_ENABLED == 'true'
|
||||
if: github.repository == 'langbot-app/LangBot' && github.ref == 'refs/heads/master' && vars.DOCS_PUBLISH_ENABLED == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 20
|
||||
defaults:
|
||||
@@ -26,7 +26,7 @@ jobs:
|
||||
with:
|
||||
ref: master
|
||||
fetch-depth: 0
|
||||
# A PAT push triggers the mirror and Wiki workflows; GITHUB_TOKEN does not.
|
||||
# A PAT push triggers the landing and Wiki workflows; GITHUB_TOKEN does not.
|
||||
token: ${{ secrets.LANGBOT_WIKI_PUSH_TOKEN || secrets.RELEASE_UPLOAD_GITHUB_TOKEN }}
|
||||
- uses: actions/setup-node@v7
|
||||
with:
|
||||
|
||||
@@ -57,7 +57,7 @@ jobs:
|
||||
|
||||
sync:
|
||||
name: Publish to LangBot Wiki
|
||||
if: github.event_name != 'pull_request' && github.repository == 'langbot-app/LangBot' && github.ref == 'refs/heads/master' && vars.DOCS_MIRROR_ENABLED == 'true'
|
||||
if: github.event_name != 'pull_request' && github.repository == 'langbot-app/LangBot' && github.ref == 'refs/heads/master' && vars.DOCS_PUBLISH_ENABLED == 'true'
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 5
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
name: Sync docs mirror and landing submodule
|
||||
name: Sync landing docs from LangBot
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -15,7 +15,7 @@ concurrency:
|
||||
|
||||
jobs:
|
||||
sync:
|
||||
if: github.repository == 'langbot-app/LangBot' && github.ref == 'refs/heads/master' && vars.DOCS_MIRROR_ENABLED == 'true'
|
||||
if: github.repository == 'langbot-app/LangBot' && github.ref == 'refs/heads/master' && vars.DOCS_PUBLISH_ENABLED == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 20
|
||||
steps:
|
||||
@@ -27,16 +27,6 @@ jobs:
|
||||
- name: Test synchronization contracts
|
||||
working-directory: docs
|
||||
run: python3 -m unittest discover -s tests -p test_sync_landing_submodule.py -v
|
||||
- name: Publish docs subtree (fast-forward only)
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.LANGBOT_WIKI_PUSH_TOKEN || secrets.RELEASE_UPLOAD_GITHUB_TOKEN }}
|
||||
run: |
|
||||
gh auth setup-git
|
||||
git remote add docs-mirror https://github.com/langbot-app/langbot-docs.git
|
||||
git fetch docs-mirror main
|
||||
docs_sha=$(git subtree split --prefix=docs)
|
||||
git merge-base --is-ancestor docs-mirror/main "$docs_sha"
|
||||
git push docs-mirror "$docs_sha:refs/heads/main"
|
||||
- name: Update landing submodule and production fork
|
||||
working-directory: docs
|
||||
env:
|
||||
|
||||
Reference in New Issue
Block a user