|
| 1 | +name: CodeBoarding |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + types: [opened, reopened, closed, synchronize] |
| 6 | + issue_comment: |
| 7 | + types: [created] |
| 8 | + # Sync keeps one branch's analysis, so this lists exactly one. There is no manual |
| 9 | + # trigger: a dispatch could run sync on any branch. |
| 10 | + push: |
| 11 | + branches: ['main'] |
| 12 | + # Loop guard: sync commits these to main. Generated files only, so an edit to |
| 13 | + # the user-authored configuration under .codeboarding/ still triggers a sync. |
| 14 | + paths-ignore: |
| 15 | + - '.codeboarding/analysis.json' |
| 16 | + - '.codeboarding/fingerprint.json' |
| 17 | + - '.codeboarding/static_analysis.pkl' |
| 18 | + - '.codeboarding/static_analysis.sha' |
| 19 | + - '.codeboarding/codeboarding_version.json' |
| 20 | + - '.codeboarding/health/health_report.json' |
| 21 | + |
| 22 | +# No workflow-level permissions: each job requests only what it needs (least |
| 23 | +# privilege), so the default token starts with none. |
| 24 | +permissions: {} |
| 25 | + |
| 26 | +# Reviews queue per pull request, syncs per branch. Closing a pull request cancels its review. |
| 27 | +concurrency: |
| 28 | + group: codeboarding-${{ github.event.pull_request.number || github.event.issue.number || github.ref_name }} |
| 29 | + cancel-in-progress: ${{ github.event_name == 'pull_request' && github.event.action == 'closed' }} |
| 30 | + |
| 31 | +jobs: |
| 32 | + review: |
| 33 | + if: > |
| 34 | + (github.event_name == 'pull_request' && github.event.action != 'closed' && |
| 35 | + github.event.pull_request.head.repo.full_name == github.repository) || |
| 36 | + (github.event_name == 'issue_comment' && github.event.issue.pull_request != null && |
| 37 | + startsWith(github.event.comment.body, '/codeboarding') && |
| 38 | + contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association)) |
| 39 | + runs-on: ubuntu-latest |
| 40 | + timeout-minutes: 60 |
| 41 | + permissions: |
| 42 | + contents: read # check out the repo + read the saved analysis (no writes in review mode) |
| 43 | + pull-requests: write # post the architecture-diff PR comment |
| 44 | + issues: write # the /codeboarding issue_comment trigger + comment API |
| 45 | + id-token: write # mint a GitHub OIDC token for the free hosted tier (write is the only level for id-token) |
| 46 | + actions: read # let a repeat review download the analysis an earlier run published, instead of re-deriving the whole PR |
| 47 | + steps: |
| 48 | + - uses: CodeBoarding/CodeBoarding-action@v1 |
| 49 | + with: |
| 50 | + codeboarding_analysis_location: in_place |
| 51 | + # CodeBoarding's free hosted tier. No secret to add: the run authenticates |
| 52 | + # with the GitHub OIDC token that `id-token: write` above grants. |
| 53 | + llm: hosted |
| 54 | + |
| 55 | + sync: |
| 56 | + if: github.event_name == 'push' |
| 57 | + runs-on: ubuntu-latest |
| 58 | + timeout-minutes: 60 |
| 59 | + permissions: |
| 60 | + contents: write # commit the generated analysis to main |
| 61 | + actions: read # continue from an analysis an earlier run published |
| 62 | + id-token: write # identifies this repo to CodeBoarding's hosted tier |
| 63 | + steps: |
| 64 | + - uses: CodeBoarding/CodeBoarding-action@v1 |
| 65 | + with: |
| 66 | + mode: sync |
| 67 | + codeboarding_analysis_location: in_place |
| 68 | + # CodeBoarding's free hosted tier. No secret to add: the run authenticates |
| 69 | + # with the GitHub OIDC token that `id-token: write` above grants. |
| 70 | + llm: hosted |
0 commit comments