|
| 1 | +name: gateway |
| 2 | + |
| 3 | +# Opt-in code-review bot. Triggered by a `/gateway <command>` comment on a PR |
| 4 | +# (e.g. `/gateway review`); review/approve commands are gated to maintainers. |
| 5 | +# Comment-commands only, so fork PRs that receive no secrets never spawn |
| 6 | +# failing runs. |
| 7 | +# |
| 8 | +# Thin shim: the public lightninglabs/gateway-action mints an App token and |
| 9 | +# checks out the private gateway runtime at execution time. The runtime stays |
| 10 | +# private; only this entry point is public. |
| 11 | + |
| 12 | +on: |
| 13 | + issue_comment: |
| 14 | + types: [created] |
| 15 | + pull_request_review_comment: |
| 16 | + types: [created] |
| 17 | + |
| 18 | +permissions: |
| 19 | + # The action mints an App installation token internally; the GITHUB_TOKEN |
| 20 | + # handed to this shim is unused, so we minimise it. |
| 21 | + contents: read |
| 22 | + |
| 23 | +jobs: |
| 24 | + review: |
| 25 | + # issue_comment fires for all issues and every PR comment. Filter to PR |
| 26 | + # comments that look like a /gateway command so unrelated comments don't |
| 27 | + # spin up a no-op runner. `contains` (not `startsWith`) because the runtime |
| 28 | + # accepts the command at column 0 of any line, including multi-line bodies. |
| 29 | + if: >- |
| 30 | + ${{ |
| 31 | + (github.event_name == 'issue_comment' |
| 32 | + && github.event.issue.pull_request != null |
| 33 | + && contains(github.event.comment.body, '/gateway')) || |
| 34 | + (github.event_name == 'pull_request_review_comment' |
| 35 | + && contains(github.event.comment.body, '/gateway')) |
| 36 | + }} |
| 37 | + runs-on: ubuntu-latest |
| 38 | + timeout-minutes: 15 |
| 39 | + env: |
| 40 | + GATEWAY_REVIEW_MODE: multi |
| 41 | + steps: |
| 42 | + - uses: lightninglabs/gateway-action@3a31b86adf442852801a04ddb9c6bc0f12d363da # v0.5.0 |
| 43 | + with: |
| 44 | + # Pin the private runtime to an immutable commit (matches the action |
| 45 | + # SHA-pin above) so runtime upgrades go through an lndinit PR, not a |
| 46 | + # moved tag. Without this, runtime_ref defaults to the v0.5.0 tag. |
| 47 | + runtime_ref: b7490e68db31b391becfe9534e947b8004fc518b # gateway v0.5.0 |
| 48 | + event_name: ${{ github.event_name }} |
| 49 | + event_action: ${{ github.event.action }} |
| 50 | + repo: ${{ github.repository }} |
| 51 | + pr_number: ${{ github.event.issue.number || github.event.pull_request.number }} |
| 52 | + actor: ${{ github.event.sender.login }} |
| 53 | + comment_body: ${{ github.event.comment.body }} |
| 54 | + comment_id: ${{ github.event.comment.id }} |
| 55 | + comment_in_reply_to: ${{ github.event.comment.in_reply_to_id }} |
| 56 | + # installation_id intentionally omitted: as of gateway v0.4.4 the |
| 57 | + # runtime resolves the App installation covering this repo from |
| 58 | + # app_id/private_key, so a hardcoded and easily wrong-org id is no |
| 59 | + # longer needed. |
| 60 | + app_id: ${{ secrets.GATEWAY_APP_ID }} |
| 61 | + private_key: ${{ secrets.GATEWAY_PRIVATE_KEY }} |
| 62 | + claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} |
0 commit comments