ok-to-test-managed.yml 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. # If someone with write access comments "/ok-to-test-managed" 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-managed:
  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. # Generate a GitHub App installation access token from an App ID and private key
  17. # To create a new GitHub App:
  18. # https://developer.github.com/apps/building-github-apps/creating-a-github-app/
  19. # See app.yml for an example app manifest
  20. - uses: step-security/harden-runner@fe104658747b27e96e4f7e80cd0a94068e53901d # v2.16.1
  21. with:
  22. egress-policy: audit
  23. - name: Generate token
  24. id: generate_token
  25. uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v3.0.0
  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. env:
  33. TOKEN: ${{ steps.generate_token.outputs.token }}
  34. with:
  35. token: ${{ env.TOKEN }} # GitHub App installation access token
  36. reaction-token: ${{ secrets.GITHUB_TOKEN }}
  37. issue-type: pull-request
  38. commands: ok-to-test-managed
  39. permission: maintain