Sends a repository's pull request events to Diffy, Roboto's code review, without a webhook and
without a shared secret. Use it when Roboto's review account, roboto-pr, has Write on your
repository rather than Admin.
- Ask Roboto to bind the repository for the Action. Until then, Diffy refuses the events and the run fails.
- Commit this file on the repository's default branch, as
.github/workflows/diffy-review.yml:
name: Diffy review
on:
pull_request_target:
types: [opened, synchronize, ready_for_review]
issue_comment:
types: [created]
permissions:
id-token: write
jobs:
review:
if: github.event_name == 'pull_request_target' || (github.event.issue.pull_request && contains(github.event.comment.body, '@roboto-pr'))
runs-on: ubuntu-latest
steps:
- uses: robotostudio/diffy-review@v1When a pull request opens, gets new commits or is marked ready, or a comment on one names
@roboto-pr, the action:
- asks GitHub for an OIDC token with the audience
https://pr.robotostudio.com. GitHub signs it, and it names the repository, its owner and the event; - posts the event GitHub gave the workflow to
https://pr.robotostudio.com/eve/v1/github, with the token as a bearer.
Diffy checks the token against GitHub's keys, and checks that the repository and the owner it names are the ones you agreed with Roboto. It needs no secret from you.
The action checks out no code and reads no secret. id-token: write is the only permission the
workflow gives it. It needs bash, curl and jq, which GitHub's hosted runners have.
pull_request_target and issue_comment run the default branch's copy of the workflow. A
pull_request run uses the pull request's own copy, which its author can change, so Diffy refuses
it. For the same reason, a pull request from a fork reaches Diffy safely; whether it is reviewed is
your Diffy settings' call (off by default). The action never runs the pull request's code.
- A
@roboto-prin a comment on a line of the diff. Write it on the pull request's conversation. - Preview deployments. Diffy does not see them, so a review never opens one.
- A repository or organisation with GitHub Actions turned off.
Each run costs a few seconds of your GitHub Actions time. A plain comment still shows a run in the
Actions tab, but the if: in the file skips its job at once, so it costs nothing.