name: RFC action

on:
  issue_comment:
    types: [created]

permissions: write-all

jobs:
  rfc-action:
    name: Handle an RFC-related command
    if: ${{ github.event.issue.pull_request && startsWith(github.event.comment.body, '/rfc') }}
    runs-on: ubuntu-latest
    timeout-minutes: 5
    steps:
      - name: Generate a token
        id: generate_token
        uses: actions/create-github-app-token@v1.8.1
        with:
          app-id: ${{ secrets.RFC_BOT_APP_ID }}
          private-key: ${{ secrets.RFC_BOT_PRIVATE_KEY }}
      - uses: paritytech/rfc-action@2fd06c94cc98b4f66f37a35f25d6a69515e4d49f # v0.1.1
        env:
          GH_TOKEN: ${{ steps.generate_token.outputs.token }}
