|
| 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: ['dev'] |
| 12 | + |
| 13 | +# No workflow-level permissions: each job requests only what it needs (least |
| 14 | +# privilege), so the default token starts with none. |
| 15 | +permissions: {} |
| 16 | + |
| 17 | +# Reviews queue per pull request, syncs per branch. Closing a pull request cancels its review. |
| 18 | +concurrency: |
| 19 | + group: codeboarding-${{ github.event.pull_request.number || github.event.issue.number || github.ref_name }} |
| 20 | + cancel-in-progress: ${{ github.event_name == 'pull_request' && github.event.action == 'closed' }} |
| 21 | + |
| 22 | +jobs: |
| 23 | + review: |
| 24 | + if: > |
| 25 | + (github.event_name == 'pull_request' && github.event.action != 'closed' && |
| 26 | + github.event.pull_request.head.repo.full_name == github.repository) || |
| 27 | + (github.event_name == 'issue_comment' && github.event.issue.pull_request != null && |
| 28 | + startsWith(github.event.comment.body, '/codeboarding') && |
| 29 | + contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association)) |
| 30 | + runs-on: ubuntu-latest |
| 31 | + timeout-minutes: 60 |
| 32 | + permissions: |
| 33 | + contents: read # check out the repo + read the saved analysis (no writes in review mode) |
| 34 | + pull-requests: write # post the architecture-diff PR comment |
| 35 | + issues: write # the /codeboarding issue_comment trigger + comment API |
| 36 | + id-token: write # mint a GitHub OIDC token for the free hosted tier (write is the only level for id-token) |
| 37 | + actions: read # let a repeat review download the analysis an earlier run published, instead of re-deriving the whole PR |
| 38 | + steps: |
| 39 | + - uses: CodeBoarding/CodeBoarding-action@v1 |
| 40 | + with: |
| 41 | + # CodeBoarding's free hosted tier. No secret to add: the run authenticates |
| 42 | + # with the GitHub OIDC token that `id-token: write` above grants. |
| 43 | + llm: hosted |
| 44 | + |
| 45 | + sync: |
| 46 | + if: github.event_name == 'push' |
| 47 | + runs-on: ubuntu-latest |
| 48 | + timeout-minutes: 60 |
| 49 | + permissions: |
| 50 | + contents: write # push the generated analysis to codeboarding/baseline |
| 51 | + actions: read # continue from an analysis an earlier run published |
| 52 | + id-token: write # identifies this repo to CodeBoarding's hosted tier |
| 53 | + steps: |
| 54 | + - uses: CodeBoarding/CodeBoarding-action@v1 |
| 55 | + with: |
| 56 | + mode: sync |
| 57 | + # CodeBoarding's free hosted tier. No secret to add: the run authenticates |
| 58 | + # with the GitHub OIDC token that `id-token: write` above grants. |
| 59 | + llm: hosted |
0 commit comments