Ok To Test
GitHub Actions is a first class citizen on GitHub used for workflow automation of all kinds. If you’re new to this feature, let me point you to these fantastic write-ups ✨:
- https://jeffrafter.com/working-with-github-actions/
- https://jasonet.co/posts/new-features-of-github-actions/
Background
Ok, now you’re an Actions expert. You know about the CI/CD primitives, the secret store, and how thousands of actions and hundreds of thousands of workflows have already been built. For example, this workflow will kick off integration tests when a pull request is opened and publish it to npm when the pull request is merged into the main
branch:
Problem
And you have a keen eye. You and some other eagle eyes have noticed that there is one hang-up with forks: they don’t play well with secrets! When your open source project gets a pull request from a fork, and you kick off the workflow above ☝️, the publish fails because the secret isn’t available. This is intentional for security reasons.
Workaround
But wait, there is a workaround: https://github.com/imjohnbo/ok-to-test! Imagine typing a slash command /ok-to-test
as a pull request comment after looking over the incoming proposal, which kicks off the workflow above with secrets. No more publishing failure! This workaround uses a wee repository_dispatch
event and leverages a few very handy community actions.
Check out the repository for all the details, and let me know what you think there.
Happy pull requesting!
–John