-
Notifications
You must be signed in to change notification settings - Fork 0
Add glossary with auto-update logic #4
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
Open
kkorotkov
wants to merge
3
commits into
master
Choose a base branch
from
2k/add-glossary
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,169 @@ | ||
| name: Glossary Monitor | ||
|
|
||
| # Runs every Monday at 09:00 UTC and can be triggered manually. | ||
| # On each run it scans all labs64.io-* repositories for documentation, | ||
| # uses an LLM via OpenRouter to propose glossary updates, and opens a PR | ||
| # only when the glossary content actually changes. | ||
|
|
||
| # ----------------------------------------------------------------------- | ||
| # ARCHITECTURE NOTE — why everything goes through PRs, never direct push | ||
| # ----------------------------------------------------------------------- | ||
| # The default branch is assumed to be protected (required PR reviews, | ||
| # status checks, etc.). Direct `git push` to it would either be blocked | ||
| # or silently bypass those rules depending on the token used. | ||
| # All commits from this workflow — glossary updates AND the encrypted | ||
| # state file — are therefore proposed via peter-evans/create-pull-request, | ||
| # which targets a separate branch and opens/updates a PR. | ||
| # Do not replace these steps with a bare `git commit && git push`. | ||
| # ----------------------------------------------------------------------- | ||
|
|
||
| # ----------------------------------------------------------------------- | ||
| # ARCHITECTURE NOTE — when to advance the state baseline (state_changed) | ||
| # ----------------------------------------------------------------------- | ||
| # The state file records the HEAD SHA of each repo after a run so the | ||
| # next run skips commits already evaluated. | ||
| # | ||
| # It only needs to be updated when the LLM was actually invoked — i.e. | ||
| # when changed or removed doc files were found. Re-examining commits that | ||
| # contain no doc files costs only a few GitHub API calls (cheap), so | ||
| # there is no benefit to recording those commits in state. | ||
| # | ||
| # This collapses state_changed to the same condition as "did we call | ||
| # the LLM", which equals "were there any changed or removed doc files". | ||
| # If no doc files changed, state is left untouched and those commits are | ||
| # re-scanned next run at negligible cost. Do not widen state_changed to | ||
| # fire on every run — it would open noisy PRs with no meaningful payload. | ||
| # ----------------------------------------------------------------------- | ||
|
|
||
| on: | ||
| schedule: | ||
| - cron: '0 9 * * 1' # Every Monday 09:00 UTC | ||
| workflow_dispatch: # Manual trigger from the Actions tab | ||
|
|
||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
|
|
||
| jobs: | ||
| update-glossary: | ||
| name: Scan repos and update GLOSSARY.md | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 15 | ||
|
|
||
| steps: | ||
| - name: Checkout labs64.io-docs | ||
| uses: actions/checkout@v4 | ||
|
|
||
| # The state file contains private repository names and HEAD SHAs. | ||
| # It is stored encrypted in the repo (scripts/.glossary-state.json.enc) | ||
| # so the plaintext never appears in the public git history. | ||
| # Decrypt with STATE_ENCRYPTION_KEY (a repository secret: any strong | ||
| # passphrase, e.g. `openssl rand -hex 32`). | ||
| - name: Decrypt state file | ||
| env: | ||
| STATE_ENCRYPTION_KEY: ${{ secrets.STATE_ENCRYPTION_KEY }} | ||
| run: | | ||
| if [ -f scripts/.glossary-state.json.enc ]; then | ||
| openssl enc -aes-256-cbc -d -pbkdf2 \ | ||
| -pass env:STATE_ENCRYPTION_KEY \ | ||
| -in scripts/.glossary-state.json.enc \ | ||
| -out scripts/.glossary-state.json | ||
| fi | ||
|
|
||
| - name: Set up Python 3.12 | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.12' | ||
| cache: pip | ||
| cache-dependency-path: scripts/requirements.txt | ||
|
|
||
| - name: Install dependencies | ||
| run: pip install -r scripts/requirements.txt | ||
|
|
||
| - name: Run glossary monitor | ||
| id: monitor | ||
| env: | ||
| # GH_TOKEN must have read access to all labs64.io-* repos (public + private). | ||
| # Use a classic PAT or a fine-grained token with "Contents: Read" on all target repos. | ||
| # Store it as a repository secret named GH_TOKEN. | ||
| GH_TOKEN: ${{ secrets.GH_TOKEN }} | ||
| OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }} | ||
| run: python scripts/glossary_monitor.py | ||
|
|
||
| # Re-encrypt the updated state so it is ready for either PR step below. | ||
| # The .enc file is safe to store publicly — without STATE_ENCRYPTION_KEY | ||
| # it reveals nothing about private repo names or commit SHAs. | ||
| - name: Encrypt state file | ||
| if: steps.monitor.outputs.state_changed == 'true' | ||
| env: | ||
| STATE_ENCRYPTION_KEY: ${{ secrets.STATE_ENCRYPTION_KEY }} | ||
| run: | | ||
| openssl enc -aes-256-cbc -pbkdf2 \ | ||
| -pass env:STATE_ENCRYPTION_KEY \ | ||
| -in scripts/.glossary-state.json \ | ||
| -out scripts/.glossary-state.json.enc | ||
|
|
||
| # When the glossary changed, the state travels in the same PR so both | ||
| # land on the default branch together when the PR is merged. | ||
| - name: Open glossary PR | ||
| if: steps.monitor.outputs.glossary_changed == 'true' | ||
| uses: peter-evans/create-pull-request@v6 | ||
| with: | ||
| token: ${{ secrets.GH_TOKEN }} | ||
| branch: glossary/auto-update | ||
| base: ${{ github.event.repository.default_branch }} | ||
| title: "docs: glossary update from weekly repository scan" | ||
| body: | | ||
| This PR was opened automatically by the **Glossary Monitor** workflow. | ||
|
|
||
| ### What changed | ||
| The job scanned all `labs64.io-*` repositories and used an LLM via OpenRouter to: | ||
| - Add terms present in documentation but missing from the glossary | ||
| - Improve definitions that were incomplete or outdated | ||
| - Expand the *Context* column for terms that appear in additional modules | ||
|
|
||
| ### Review checklist | ||
| - [ ] New terms are accurate and belong in a human-readable glossary | ||
| - [ ] Definitions are concise and free of code symbols | ||
| - [ ] Context column lists the correct module(s) | ||
| - [ ] Alphabetical order is preserved | ||
|
|
||
| > Generated by [`scripts/glossary_monitor.py`](../blob/master/scripts/glossary_monitor.py) | ||
|
|
||
| commit-message: "docs: auto-update GLOSSARY.md via glossary-monitor" | ||
| labels: | | ||
| documentation | ||
| automated | ||
| # Re-use the same branch so repeated runs update the existing PR | ||
| # instead of opening a new one each time. | ||
| delete-branch: false | ||
| add-paths: | | ||
| GLOSSARY.md | ||
| scripts/.glossary-auto.md | ||
| scripts/.glossary-state.json.enc | ||
|
|
||
| # When docs were scanned but the glossary needed no changes, open a | ||
| # minimal PR to advance the state baseline so the next run does not | ||
| # re-examine the same commits. Reuses the same branch across weeks so | ||
| # a lingering unmerged PR is updated in place rather than duplicated. | ||
| - name: Open state-only PR | ||
| if: >- | ||
| steps.monitor.outputs.state_changed == 'true' && | ||
| steps.monitor.outputs.glossary_changed != 'true' | ||
| uses: peter-evans/create-pull-request@v6 | ||
| with: | ||
| token: ${{ secrets.GH_TOKEN }} | ||
| branch: glossary/state-update | ||
| base: ${{ github.event.repository.default_branch }} | ||
| title: "chore: advance glossary monitor state baseline" | ||
|
Copilot marked this conversation as resolved.
|
||
| body: | | ||
| The **Glossary Monitor** ran this week and scanned new commits across | ||
| `labs64.io-*` repositories, but found no glossary changes to propose. | ||
|
|
||
| This PR advances the encrypted state baseline so the next weekly run | ||
| does not re-examine the same commits. Safe to merge without review. | ||
| commit-message: "chore: update glossary monitor state [skip ci]" | ||
| labels: | | ||
| automated | ||
| delete-branch: false | ||
| add-paths: | | ||
| scripts/.glossary-state.json.enc | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| # Glossary — Manual Entries | ||
|
|
||
| Maintain this file by hand. Add, edit, or remove rows directly. | ||
|
|
||
| The monitor script (`scripts/glossary_monitor.py`) merges these entries with | ||
| AI-generated ones and writes the combined, alphabetically sorted result to | ||
| `GLOSSARY.md`. Do not edit `GLOSSARY.md` directly — it is regenerated on every run. | ||
|
|
||
| If a term exists in both this file and the AI-generated source, this file wins. | ||
|
|
||
| **Context column:** use plain module names (e.g. `Checkout, Payment Gateway`). | ||
| The build script resolves them to links automatically. | ||
|
|
||
| | Term | Context | Definition | | ||
| |------|---------|------------| | ||
| | **JWT (JSON Web Token)** | Checkout, Payment Gateway | A signed token used to authenticate and authorize API requests. The tenant identity is derived from the JWT payload. | |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.