ok-to-test-managed.yml 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
  21. with:
  22. egress-policy: audit
  23. - name: Generate token
  24. id: generate_token
  25. uses: actions/create-github-app-token@67018539274d69449ef7c02e8e71183d1719ab42 # v2.1.4
  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@13bc09769d122a64f75aa5037256f6f2d78be8c4 # v4.0.0
  32. env:
  33. TOKEN: ${{ steps.generate_token.outputs.token }}
  34. with:
  35. token: ${{ env.TOKEN }} # GitHub App installation access token
  36. # token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} # PAT or OAuth token will also work
  37. reaction-token: ${{ secrets.GITHUB_TOKEN }}
  38. issue-type: pull-request
  39. commands: ok-to-test-managed
  40. permission: maintain