-
Notifications
You must be signed in to change notification settings - Fork 0
Docfx/context7 chat #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| [ ] |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,139 @@ | ||||||||||||||||||||
| name: Service Update | ||||||||||||||||||||
|
|
||||||||||||||||||||
| on: | ||||||||||||||||||||
| repository_dispatch: | ||||||||||||||||||||
| types: [codebelt-service-update] | ||||||||||||||||||||
| workflow_dispatch: | ||||||||||||||||||||
| inputs: | ||||||||||||||||||||
| source_repo: | ||||||||||||||||||||
| description: 'Triggering source repo name (e.g. cuemon)' | ||||||||||||||||||||
| required: false | ||||||||||||||||||||
| default: '' | ||||||||||||||||||||
| source_version: | ||||||||||||||||||||
| description: 'Version released by source (e.g. 10.3.0)' | ||||||||||||||||||||
| required: false | ||||||||||||||||||||
| default: '' | ||||||||||||||||||||
| dry_run: | ||||||||||||||||||||
| type: boolean | ||||||||||||||||||||
| description: 'Dry run — show changes but do not commit or open PR' | ||||||||||||||||||||
| default: false | ||||||||||||||||||||
|
|
||||||||||||||||||||
| permissions: | ||||||||||||||||||||
| contents: write | ||||||||||||||||||||
| pull-requests: write | ||||||||||||||||||||
|
|
||||||||||||||||||||
| jobs: | ||||||||||||||||||||
| service-update: | ||||||||||||||||||||
| runs-on: ubuntu-24.04 | ||||||||||||||||||||
|
|
||||||||||||||||||||
| steps: | ||||||||||||||||||||
| - name: Checkout | ||||||||||||||||||||
| uses: actions/checkout@v4 | ||||||||||||||||||||
| with: | ||||||||||||||||||||
| fetch-depth: 0 | ||||||||||||||||||||
|
|
||||||||||||||||||||
| - name: Resolve trigger inputs | ||||||||||||||||||||
| id: trigger | ||||||||||||||||||||
| run: | | ||||||||||||||||||||
| SOURCE="${{ github.event.client_payload.source_repo || github.event.inputs.source_repo }}" | ||||||||||||||||||||
| VERSION="${{ github.event.client_payload.source_version || github.event.inputs.source_version }}" | ||||||||||||||||||||
| echo "source=$SOURCE" >> $GITHUB_OUTPUT | ||||||||||||||||||||
| echo "version=$VERSION" >> $GITHUB_OUTPUT | ||||||||||||||||||||
|
|
||||||||||||||||||||
| - name: Determine new version for this repo | ||||||||||||||||||||
| id: newver | ||||||||||||||||||||
| run: | | ||||||||||||||||||||
| CURRENT=$(grep -oP '(?<=## \[)[\d.]+(?=\])' CHANGELOG.md | head -1) | ||||||||||||||||||||
| NEW=$(echo "$CURRENT" | awk -F. '{printf "%s.%s.%d", $1, $2, $3+1}') | ||||||||||||||||||||
| BRANCH="v${NEW}/service-update" | ||||||||||||||||||||
| echo "current=$CURRENT" >> $GITHUB_OUTPUT | ||||||||||||||||||||
| echo "new=$NEW" >> $GITHUB_OUTPUT | ||||||||||||||||||||
| echo "branch=$BRANCH" >> $GITHUB_OUTPUT | ||||||||||||||||||||
|
|
||||||||||||||||||||
| - name: Generate codebelt-aicia token | ||||||||||||||||||||
| id: app-token | ||||||||||||||||||||
| uses: actions/create-github-app-token@v1 | ||||||||||||||||||||
| with: | ||||||||||||||||||||
| app-id: ${{ vars.CODEBELT_AICIA_APP_ID }} | ||||||||||||||||||||
| private-key: ${{ secrets.CODEBELT_AICIA_PRIVATE_KEY }} | ||||||||||||||||||||
| owner: codebeltnet | ||||||||||||||||||||
|
|
||||||||||||||||||||
| - name: Bump NuGet packages | ||||||||||||||||||||
| run: python3 .github/scripts/bump-nuget.py | ||||||||||||||||||||
|
||||||||||||||||||||
| run: python3 .github/scripts/bump-nuget.py | |
| shell: bash | |
| run: | | |
| if [ -f ".github/scripts/bump-nuget.py" ]; then | |
| echo "Running .github/scripts/bump-nuget.py to bump NuGet packages..." | |
| python3 .github/scripts/bump-nuget.py | |
| else | |
| echo "Warning: .github/scripts/bump-nuget.py not found; skipping NuGet package bump." | |
| fi |
Copilot
AI
Feb 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The TFM=$(grep ... | sed ... || echo ...) fallback will never execute because the pipeline exit status is from sed (which succeeds even when grep finds nothing). This can leave TFM empty if the Availability line is missing. Consider restructuring this to handle the grep-no-match case explicitly (or enable pipefail).
| TFM=$(grep -m1 "^Availability:" "$f" | sed 's/Availability: //' || echo ".NET 10, .NET 9 and .NET Standard 2.0") | |
| AVAIL_LINE=$(grep -m1 "^Availability:" "$f" || true) | |
| if [ -z "$AVAIL_LINE" ]; then | |
| TFM=".NET 10, .NET 9 and .NET Standard 2.0" | |
| else | |
| TFM=${AVAIL_LINE#Availability: } | |
| fi |
Copilot
AI
Feb 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
git push origin "$BRANCH" will use the credentials configured by actions/checkout (typically GITHUB_TOKEN), not the GitHub App token generated in app-token. If the intent is to authenticate pushes as the app (e.g., for audit/bypass/consistent attribution), you need to disable persisted checkout credentials and/or reconfigure the remote URL to use the app token before pushing.
| git commit -m "V${NEW}/service update" | |
| git commit -m "V${NEW}/service update" | |
| git remote set-url origin "https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }}.git" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| name: Trigger Downstream Service Updates | ||
|
|
||
| on: | ||
| release: | ||
| types: [published] | ||
|
|
||
| jobs: | ||
| dispatch: | ||
| if: github.event.release.prerelease == false | ||
| runs-on: ubuntu-24.04 | ||
| permissions: | ||
| contents: read | ||
|
|
||
| steps: | ||
| - name: Checkout (to read dispatch-targets.json) | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Check for dispatch targets | ||
| id: check | ||
| run: | | ||
| if [ ! -f .github/dispatch-targets.json ]; then | ||
| echo "No dispatch-targets.json found, skipping." | ||
| echo "has_targets=false" >> $GITHUB_OUTPUT | ||
| exit 0 | ||
| fi | ||
| COUNT=$(python3 -c "import json; print(len(json.load(open('.github/dispatch-targets.json'))))") | ||
| echo "has_targets=$([ $COUNT -gt 0 ] && echo true || echo false)" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Extract version from release tag | ||
| if: steps.check.outputs.has_targets == 'true' | ||
| id: version | ||
| run: | | ||
| VERSION="${{ github.event.release.tag_name }}" | ||
| VERSION="${VERSION#v}" | ||
| echo "version=$VERSION" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Generate codebelt-aicia token | ||
| if: steps.check.outputs.has_targets == 'true' | ||
| id: app-token | ||
| uses: actions/create-github-app-token@v1 | ||
| with: | ||
| app-id: ${{ vars.CODEBELT_AICIA_APP_ID }} | ||
| private-key: ${{ secrets.CODEBELT_AICIA_PRIVATE_KEY }} | ||
| owner: codebeltnet | ||
|
|
||
| - name: Dispatch to downstream repos | ||
| if: steps.check.outputs.has_targets == 'true' | ||
| run: | | ||
| python3 - <<'EOF' | ||
| import json, urllib.request, os, sys | ||
|
|
||
| targets = json.load(open('.github/dispatch-targets.json')) | ||
| token = os.environ['GH_TOKEN'] | ||
| version = os.environ['VERSION'] | ||
| source = os.environ['SOURCE_REPO'] | ||
|
|
||
| for repo in targets: | ||
| url = f'https://api.github.com/repos/codebeltnet/{repo}/dispatches' | ||
| payload = json.dumps({ | ||
| 'event_type': 'codebelt-service-update', | ||
| 'client_payload': { | ||
| 'source_repo': source, | ||
| 'source_version': version | ||
| } | ||
| }).encode() | ||
| req = urllib.request.Request(url, data=payload, method='POST', headers={ | ||
| 'Authorization': f'Bearer {token}', | ||
| 'Accept': 'application/vnd.github+json', | ||
| 'Content-Type': 'application/json', | ||
| 'X-GitHub-Api-Version': '2022-11-28' | ||
| }) | ||
| with urllib.request.urlopen(req) as r: | ||
| print(f'✓ Dispatched to {repo}: HTTP {r.status}') | ||
| EOF | ||
| env: | ||
| GH_TOKEN: ${{ steps.app-token.outputs.token }} | ||
| VERSION: ${{ steps.version.outputs.version }} | ||
| SOURCE_REPO: ${{ github.event.repository.name }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Appending an unpinned third-party
<script src="https://context7.com/widget.js">into the DocFX footer introduces a supply-chain/XSS risk for the published documentation site and may violate stricter CSP settings. Consider hosting/pinning the script (or using SRI + a CSP update) and documenting the trust/upgrade process for this external dependency.