summaryrefslogtreecommitdiff
path: root/.github
diff options
context:
space:
mode:
authorYuriy Andamasov <yuriy@vyos.io>2026-05-11 00:37:26 +0300
committerYuriy Andamasov <yuriy@vyos.io>2026-05-11 00:37:26 +0300
commitcfb2ff1fdc9c638fd646808d99140288e1f337c5 (patch)
tree24fe4cac52c4954cffc3cfbd4c38b6563a9b37bf /.github
parentd15e22a0bbd12b457f0d12d20e58e702c19302b7 (diff)
downloadvyos-documentation-cfb2ff1fdc9c638fd646808d99140288e1f337c5.tar.gz
vyos-documentation-cfb2ff1fdc9c638fd646808d99140288e1f337c5.zip
ci: fix Context7 refresh — branch-name addressing + default-variant handling
The post-merge auto-fired runs from #1948/#1949/#1950 all returned 4xx errors. Diagnostic curls against the live Context7 API revealed two issues: 1. The 'branch' parameter addresses variants by their underlying Git branch name (rolling/circinus/sagitta), not by their tag display name (rolling/1.5/1.4). Sending 'branch: "1.5"' returns: HTTP 404 {"error":"branch_not_found","message":"Branch '1.5' not found"} 2. The default variant refreshes when the 'branch' field is omitted entirely. Sending 'branch: "rolling"' returns: HTTP 400 {"error":"branch-not-found","message":"Failed to refresh library"} But omitting the field returns: HTTP 200 {"message":"Refresh started successfully"} 3. (Bonus, validating #1951 was wrong direction.) The libraryName must include the leading slash: 'libraryName: "/vyos/vyos-documentation"' per Context7's docs. Without the slash returns: HTTP 404 {"error":"library_not_found"} This commit restores the leading slash that #1951 incorrectly removed. Changes: - Restore leading slash on libraryName ('/' + github.repository). - Drop the tag-name mapping in the case statement; pass head_branch directly as the branch value. - Omit the 'branch' field when head_branch is 'rolling' (default variant). - workflow_dispatch input renamed from 'version' to 'branch'; choice options changed from [rolling, '1.5', '1.4'] to [rolling, circinus, sagitta]. - Simplified concurrency expression (no longer needs the rewrite chain). - Documentation comment updated to explain the branch-name addressing. Spec: ~/.claude/specs/2026-05-10-context7-github-actions-integration-design.md This is the 'fallback mapping' path that the spec's variant table already documented as a contingency — pre-flight confirmed it's the correct path. 🤖 Generated by [robots](https://vyos.io)
Diffstat (limited to '.github')
-rw-r--r--.github/workflows/context7-refresh.yml53
1 files changed, 29 insertions, 24 deletions
diff --git a/.github/workflows/context7-refresh.yml b/.github/workflows/context7-refresh.yml
index 09ddeae5..86d92735 100644
--- a/.github/workflows/context7-refresh.yml
+++ b/.github/workflows/context7-refresh.yml
@@ -1,9 +1,13 @@
name: Context7 refresh
# Listens for completion of "Update version tags" via workflow_run, then
-# refreshes the corresponding Context7 variant. The upstream workflow is
-# matched by name — DO NOT rename `Update version tags` without updating
-# the `workflows:` field below.
+# refreshes the Context7 variant for the branch that fed it. The upstream
+# workflow is matched by name — DO NOT rename `Update version tags` without
+# updating the `workflows:` field below.
+#
+# Context7 API addresses variants by their underlying Git branch name
+# (rolling/circinus/sagitta), not by their display name (rolling/1.5/1.4).
+# For the default variant (rolling) the `branch` field is OMITTED.
#
# OPERATOR NOTE: do NOT use GitHub's "Re-run jobs" on `Update version tags`.
# Re-runs replay the original SHA, which would move the version tag
@@ -17,22 +21,16 @@ on:
types: [completed]
workflow_dispatch:
inputs:
- version:
- description: "Context7 variant to refresh"
+ branch:
+ description: "Source branch whose Context7 variant to refresh"
type: choice
- options: [rolling, "1.5", "1.4"]
+ options: [rolling, circinus, sagitta]
default: rolling
permissions: {}
concurrency:
- group: >-
- context7-refresh-${{
- inputs.version
- || (github.event.workflow_run.head_branch == 'circinus' && '1.5')
- || (github.event.workflow_run.head_branch == 'sagitta' && '1.4')
- || github.event.workflow_run.head_branch
- }}
+ group: context7-refresh-${{ inputs.branch || github.event.workflow_run.head_branch }}
cancel-in-progress: true
jobs:
@@ -48,7 +46,7 @@ jobs:
env:
CONTEXT7_API_KEY: ${{ secrets.CONTEXT7_API_KEY }}
HEAD_BRANCH: ${{ github.event.workflow_run.head_branch }}
- DISPATCH_VERSION: ${{ inputs.version }}
+ DISPATCH_BRANCH: ${{ inputs.branch }}
run: |
set -euo pipefail
if [[ -z "${CONTEXT7_API_KEY:-}" ]]; then
@@ -56,16 +54,24 @@ jobs:
exit 1
fi
if [[ "${GITHUB_EVENT_NAME}" == "workflow_dispatch" ]]; then
- VARIANT="$DISPATCH_VERSION"
+ BRANCH="$DISPATCH_BRANCH"
+ else
+ BRANCH="$HEAD_BRANCH"
+ fi
+ case "$BRANCH" in
+ rolling|circinus|sagitta) ;;
+ *) echo "Unexpected branch: $BRANCH" >&2; exit 1 ;;
+ esac
+ echo "Refreshing Context7 variant for branch: $BRANCH"
+ # Default variant (rolling) refreshes when `branch` is omitted;
+ # non-default variants address by their Git branch name.
+ if [[ "$BRANCH" == "rolling" ]]; then
+ PAYLOAD="$(jq -nc --arg lib "/${{ github.repository }}" \
+ '{libraryName: $lib}')"
else
- case "$HEAD_BRANCH" in
- rolling) VARIANT=rolling ;;
- circinus) VARIANT=1.5 ;;
- sagitta) VARIANT=1.4 ;;
- *) echo "Unexpected head_branch: $HEAD_BRANCH" >&2; exit 1 ;;
- esac
+ PAYLOAD="$(jq -nc --arg lib "/${{ github.repository }}" --arg br "$BRANCH" \
+ '{libraryName: $lib, branch: $br}')"
fi
- echo "Refreshing Context7 variant: $VARIANT"
curl -fsSL \
--connect-timeout 10 \
--max-time 60 \
@@ -74,5 +80,4 @@ jobs:
"https://context7.com/api/v1/refresh" \
-H "Authorization: Bearer $CONTEXT7_API_KEY" \
-H "Content-Type: application/json" \
- -d "$(jq -nc --arg lib "${{ github.repository }}" --arg br "$VARIANT" \
- '{libraryName: $lib, branch: $br}')"
+ -d "$PAYLOAD"