Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .github/workflows/codeboarding-sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: CodeBoarding sync

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Add the required empty changeset

This commit only adds non-package workflow configuration but includes no .changeset/*.md entry, so the repository's enforce-changeset job will reject the PR. Add a changeset with empty frontmatter and a brief description of the workflow update.

AGENTS.md reference: AGENTS.md:L43-L48

Useful? React with 👍 / 👎.


on:
push:
branches: ['main']
# Loop guard: don't re-trigger on the files this workflow itself commits.
# List generated files only: user-authored scope configuration must still trigger
# regeneration, while a merged sync PR must not trigger a loop.
paths-ignore:
- '.codeboarding/*.md'
- '.codeboarding/analysis.json'
- '.codeboarding/fingerprint.json'
- '.codeboarding/static_analysis.pkl'
- '.codeboarding/static_analysis.sha'
- '.codeboarding/codeboarding_version.json'
- '.codeboarding/health/health_report.json'
- 'docs/development/architecture.md'
workflow_dispatch:
inputs:
force_full:
description: 'Ignore the committed baseline and rebuild it from scratch (full analysis).'
type: boolean
required: false
default: false

permissions:
contents: write # commit the generated baseline + docs to the branch
id-token: write # identifies this repo to CodeBoarding's hosted tier, used by the free
# tier AND a license, and as the fallback until your own key exists

concurrency:
# Serialize against itself so a push landing mid-run can't make two commits.
group: codeboarding-sync
cancel-in-progress: false

jobs:
sync:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: CodeBoarding/CodeBoarding-action@v1
with:
mode: sync
force_full: ${{ inputs.force_full || false }}
target_branch: 'main'
# Free tier needs no secret; these fall through to the hosted OIDC tier when
# unset. Add either repo secret (Settings → Secrets and variables → Actions)
# for more/unmetered usage; no YAML edit required.
llm_api_key: ${{ secrets.OPENROUTER_API_KEY }} # BYO LLM provider key (OpenRouter)
license_key: ${{ secrets.CODEBOARDING_LICENSE }} # CodeBoarding paid plan
38 changes: 38 additions & 0 deletions .github/workflows/codeboarding.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: CodeBoarding review

on:
pull_request:
types: [opened, reopened, ready_for_review, closed]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Trigger review analysis when a PR is synchronized

When an author pushes additional commits to an already-open PR, GitHub emits synchronize, but that event type is omitted here. Consequently, the architecture comment and artifact remain based on the opening snapshot until someone manually invokes /codeboarding or reopens the PR; include synchronize so normal PR updates are analyzed.

Useful? React with 👍 / 👎.

issue_comment:
types: [created]

# No workflow-level permissions: each job requests only what it needs (least
# privilege), so the default token starts with none.
permissions: {}

concurrency:
group: codeboarding-${{ github.event.pull_request.number || github.event.issue.number }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Prevent unrelated comments from canceling queued analyses

Because this workflow-level concurrency group is applied to every issue_comment event before the job's command filter is evaluated, ordinary comments also enter the PR's group. GitHub retains only one pending run per concurrency group and replaces an older pending run with the newest one, so if an analysis is running, a queued /codeboarding request can be canceled by the next unrelated comment; apply concurrency only after filtering the command or isolate comment commands in a separate workflow.

Useful? React with 👍 / 👎.

cancel-in-progress: ${{ github.event_name == 'pull_request' && github.event.action == 'closed' }}

jobs:
review:
runs-on: ubuntu-latest
timeout-minutes: 60
permissions:
contents: read # check out the repo + read the committed baseline (no writes in review mode)
pull-requests: write # post the architecture-diff PR comment
issues: write # the /codeboarding issue_comment trigger + comment API
Comment on lines +23 to +24

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve review output for fork-originated PRs

For pull_request runs originating from forks, GitHub downgrades the GITHUB_TOKEN to read-only regardless of the requested write scopes here, so the action cannot use the configured comment API to create or update its architecture-diff comment on community PRs. Route the privileged commenting step through a safe trusted follow-up workflow or a GitHub App rather than relying on write permissions in the untrusted PR run.

Useful? React with 👍 / 👎.

id-token: write # mint a GitHub OIDC token for the free hosted tier (write is the only level for id-token)
if: >
(github.event_name == 'pull_request' && github.event.action != 'closed' && github.event.pull_request.draft == false) ||
(github.event_name == 'issue_comment' && github.event.issue.pull_request != null &&
startsWith(github.event.comment.body, '/codeboarding') &&
contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association))
steps:
- uses: CodeBoarding/CodeBoarding-action@v1
with:
# Free tier needs no secret; these fall through to the hosted OIDC tier when
# unset. Add either repo secret (Settings → Secrets and variables → Actions)
# for more/unmetered usage; no YAML edit required.
llm_api_key: ${{ secrets.OPENROUTER_API_KEY }} # BYO LLM provider key (OpenRouter)
license_key: ${{ secrets.CODEBOARDING_LICENSE }} # CodeBoarding paid plan
Loading