ok-to-test.yml 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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@6c439dc8bdf85cadbbce9ed30d1c7b959517bc49 # v2.12.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: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0
  26. with:
  27. app_id: ${{ secrets.APP_ID }}
  28. private_key: ${{ secrets.PRIVATE_KEY }}
  29. - name: Slash Command Dispatch
  30. uses: peter-evans/slash-command-dispatch@13bc09769d122a64f75aa5037256f6f2d78be8c4 # v4.0.0
  31. with:
  32. token: ${{ steps.generate_token.outputs.token }}
  33. reaction-token: ${{ secrets.GITHUB_TOKEN }}
  34. issue-type: pull-request
  35. commands: ok-to-test
  36. permission: maintain