ok-to-test.yml 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. # If someone with write access comments "/ok-to-test" on a pull request, emit a repository_dispatch event
  2. name: Ok To Test
  3. on:
  4. issue_comment:
  5. types: [created]
  6. permissions:
  7. contents: read
  8. jobs:
  9. ok-to-test:
  10. permissions:
  11. pull-requests: write # for peter-evans/slash-command-dispatch to create PR reaction
  12. runs-on: ubuntu-latest
  13. # Only run for PRs, not issue comments
  14. if: ${{ github.event.issue.pull_request }}
  15. steps:
  16. - uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
  17. with:
  18. egress-policy: audit
  19. # Generate a GitHub App installation access token from an App ID and private key
  20. # To create a new GitHub App:
  21. # https://developer.github.com/apps/building-github-apps/creating-a-github-app/
  22. # See app.yml for an example app manifest
  23. - name: Generate token
  24. id: generate_token
  25. uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1
  26. with:
  27. app-id: ${{ secrets.APP_ID }}
  28. private-key: ${{ secrets.PRIVATE_KEY }}
  29. owner: ${{ github.repository_owner }}
  30. - name: Slash Command Dispatch
  31. uses: peter-evans/slash-command-dispatch@9bdcd7914ec1b75590b790b844aa3b8eee7c683a # v5.0.2
  32. with:
  33. token: ${{ steps.generate_token.outputs.token }}
  34. reaction-token: ${{ secrets.GITHUB_TOKEN }}
  35. issue-type: pull-request
  36. commands: ok-to-test
  37. permission: maintain