name: wasm-bindgen-bot
on:
pull_request_target:
types: [opened, ready_for_review, synchronize, labeled, unlabeled]
issues:
types: [opened, labeled, unlabeled]
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
pull_request_review:
types: [submitted]
push:
branches: [main, master]
workflow_dispatch:
inputs:
command:
description: Command to run
type: choice
options: [pr, investigate, triage, review, rebase, issue]
default: pr
number:
description: Issue or PR number, optional for pr
required: false
request:
description: Instructions for the bot
required: false
permissions: {}
jobs:
analyze:
if: >-
(github.event_name == 'pull_request_target' && (
(github.event.action == 'labeled' && startsWith(github.event.label.name, 'bot-')) ||
(github.event.action == 'unlabeled' && startsWith(github.event.label.name, 'bot-') &&
github.event.label.name != 'bot-review' && github.event.sender.type != 'Bot') ||
((github.event.label.name == 'merge-ready' || github.event.label.name == 'author-ready') &&
(github.event.action == 'labeled' || github.event.action == 'unlabeled')) ||
(github.event.label.name == 'do not land' && github.event.action == 'unlabeled') ||
(github.event.action != 'labeled' && github.event.action != 'unlabeled' &&
!github.event.pull_request.draft &&
(github.event.pull_request.user.type != 'Bot' ||
github.event.pull_request.user.login == 'wasm-bindgen-bot[bot]')))) ||
(github.event_name == 'issues' && (
(github.event.action == 'opened' && github.event.issue.user.type != 'Bot') ||
(github.event.action == 'labeled' && startsWith(github.event.label.name, 'bot-')) ||
(github.event.action == 'unlabeled' && startsWith(github.event.label.name, 'bot-') &&
github.event.label.name != 'bot-review' && github.event.sender.type != 'Bot'))) ||
((github.event_name == 'issue_comment' ||
(github.event_name == 'pull_request_review_comment' &&
github.event.pull_request.head.repo.full_name == github.repository)) &&
(contains(github.event.comment.body, '@wasm-bindgen-bot') ||
contains(github.event.comment.body, '@wbg-bot'))) ||
(github.event_name == 'pull_request_review' &&
github.event.review.state == 'approved' &&
github.event.review.user.type != 'Bot' &&
github.event.pull_request.head.repo.full_name == github.repository) ||
github.event_name == 'workflow_dispatch' || github.event_name == 'push'
runs-on: ubuntu-latest
timeout-minutes: 100
concurrency:
group: wasm-bindgen-bot-${{ github.event.pull_request.number || github.event.issue.number || github.run_id }}${{ github.event.comment && format('-{0}', github.event.comment.id) || github.event.review && format('-review-{0}', github.event.review.id) || github.event.label && github.event.label.name != 'bot-review' && format('-{0}', github.event.label.name) || '' }}
cancel-in-progress: true
permissions:
contents: read
issues: read
pull-requests: read
steps:
- uses: wasm-bindgen/wasm-bindgen-bot/analyze@main
with:
cf-aig-token: ${{ secrets.CF_AIG_TOKEN }}
cf-account-id: ${{ vars.CF_ACCOUNT_ID }}
cf-gateway-id: ${{ vars.CF_GATEWAY_ID }}
start:
if: >-
github.event_name == 'pull_request_target' && !github.event.pull_request.draft &&
(github.event.action == 'opened' || github.event.action == 'ready_for_review' ||
github.event.action == 'synchronize' ||
(github.event.action == 'labeled' && github.event.label.name == 'bot-review')) &&
(github.event.pull_request.user.type != 'Bot' ||
github.event.pull_request.user.login == 'wasm-bindgen-bot[bot]')
runs-on: ubuntu-latest
permissions:
contents: read
issues: read
pull-requests: read
steps:
- uses: wasm-bindgen/wasm-bindgen-bot/start@main
with:
app-id: ${{ vars.WASM_BINDGEN_BOT_APP_ID }}
private-key: ${{ secrets.WASM_BINDGEN_BOT_PRIVATE_KEY }}
post:
needs: analyze
runs-on: ubuntu-latest
permissions: {}
steps:
- uses: wasm-bindgen/wasm-bindgen-bot/post@main
with:
app-id: ${{ vars.WASM_BINDGEN_BOT_APP_ID }}
private-key: ${{ secrets.WASM_BINDGEN_BOT_PRIVATE_KEY }}