All Projects → imjohnbo → ok-to-test

imjohnbo / ok-to-test

Licence: MIT license
Example workflow configuration showing how to use GitHub Actions secrets in pull requests from forks 🍴🔑

Projects that are alternatives of or similar to ok-to-test

assign-author
GitHub Actions to assign author to issue or PR
Stars: ✭ 55 (-5.17%)
Mutual labels:  pull-requests, github-actions
auto-request-review
A GitHub Action that automatically requests review of a pull request based on files changes and/or groups the author belongs to 🤖
Stars: ✭ 52 (-10.34%)
Mutual labels:  pull-requests, github-actions
aloba
🤖 [Myrmica Aloba 🐜] Bot: Add labels and milestone on pull requests and issues.
Stars: ✭ 18 (-68.97%)
Mutual labels:  pull-requests, github-actions
action-pr-title
Github action to enforce Pull Request title conventions
Stars: ✭ 83 (+43.1%)
Mutual labels:  pull-requests, github-actions
actions
A Collection of GitHub Actions
Stars: ✭ 91 (+56.9%)
Mutual labels:  secrets, github-actions
pull-request-comment-branch
A GitHub Action to get the head ref and sha of a pull request comment
Stars: ✭ 21 (-63.79%)
Mutual labels:  pull-requests, github-actions
pr-reviews-reminder-action
A GitHub Action to send Slack/Teams notification for Pull Request that are waiting for reviewers.
Stars: ✭ 18 (-68.97%)
Mutual labels:  pull-requests, github-actions
actions
Load secrets into GitHub Actions
Stars: ✭ 47 (-18.97%)
Mutual labels:  secrets, github-actions
action
📦📊 GitHub Action to reports on the size of your npm package
Stars: ✭ 36 (-37.93%)
Mutual labels:  pull-requests, github-actions
autoupdate
A GitHub Action that auto-updates pull requests branches, whenever changes are pushed to their destination branch.
Stars: ✭ 70 (+20.69%)
Mutual labels:  pull-requests, github-actions
githubsecrets
Manage your GitHub Actions secrets with a simple CLI
Stars: ✭ 41 (-29.31%)
Mutual labels:  secrets, github-actions
action-branch-name
Github action to enforce naming convention on branch names
Stars: ✭ 53 (-8.62%)
Mutual labels:  pull-requests, github-actions
chicio.github.io
👻 Fabrizio Duroni (me 😄) personal website. Created using GatsbyJS, Styled Components, Storybook, Typescript, tsParticles, GitHub pages, Github Actions, Upptime.
Stars: ✭ 20 (-65.52%)
Mutual labels:  github-actions
secret config
Centralized Configuration and Secrets Management for Ruby and Rails applications.
Stars: ✭ 15 (-74.14%)
Mutual labels:  secrets
ts-scaffold
🏗 ts-scaffold - Scaffold project for Typescript projects, with Unit Tests and basic dependencies set up
Stars: ✭ 13 (-77.59%)
Mutual labels:  github-actions
engine
A personal game engine project, with development focus towards 2D/2.5D games.
Stars: ✭ 32 (-44.83%)
Mutual labels:  github-actions
pandoc-action
github action to run pandoc, soft-deprecated ->
Stars: ✭ 39 (-32.76%)
Mutual labels:  github-actions
setup-bats
GitHub Action to setup BATS testing framework
Stars: ✭ 25 (-56.9%)
Mutual labels:  github-actions
actions-deploy-gist
📌 Deploy file to Github Gist
Stars: ✭ 26 (-55.17%)
Mutual labels:  github-actions
action-eslint
🐋🐬 TypeScript/JavaScript ESLint action
Stars: ✭ 24 (-58.62%)
Mutual labels:  github-actions

Ok To Test

Example workflow configuration showing how to use GitHub Actions secrets in pull requests from forks 🍴🔑

Summary

An Ok To Test workflow is configured so that when someone with write access to this repository comments ok-to-test sha=<head-sha> on a pull request from a fork, a "privileged" Integration tests workflow needing secrets is triggered. In parallel, a "non-privileged" Unit tests workflow not needing secrets is triggered on any pull request.

About

GitHub Actions purposely limits the secrets available to pull requests from forks for security reasons:

Though this provides peace of mind, many projects depend on the fork pull request model. If you've configured a GitHub Actions test workflow to trigger on pull requests, and those tests require secrets, the secrets aren't available and the workflow fails.

No longer with this workaround, which shows an example Prow-like /ok-to-test sha=<head-sha> slash command configuration! 🥳

This project is not affiliated with GitHub.

Setup

This is a template repository with three example workflows. Start by creating a new repository ("Use this template"). Then, consider for your use case:

  1. Which type of token you'll use to emit the repository_dispatch event in Ok To Test. Set the secrets in your repository accordingly, e.g. I used a GitHub App and had to save secrets called APP_ID and PRIVATE_KEY. Remember: if you also choose GitHub App authentication (preferred), you must create and install it on the repo(s) in which this configuration will run.
  2. Which workflow(s) need secrets. In this example, it's Integration tests, and I would need to fill in my tests here.
  3. Which workflow(s) do not need secrets. In this example, it's Unit tests. These types of workflows can simply trigger on pull request.

Usage

As someone with write access, comment /ok-to-test sha=<head-sha> on an incoming pull request to set off this Rube Goldberg machine 😄. The head sha is the first seven characters of the most recent commit of the incoming pull request. For example, /ok-to-test sha=742c71a.

Example

  1. A fork pull request is opened.
  2. A unit test workflow runs. Secrets are not available to this workflow.
  3. Someone with write access looks over the pull request code. ⚠️ Before proceeding, they should be sure the code isn't doing anything malicious like secret logging. ⚠️
  4. They comment /ok-to-test sha=<head-sha> on the pull request.
  5. A repository_dispatch API request is sent to this repository. See guidance below on how to authenticate.
  6. An integration test workflow runs, checking out the merge commit if the head sha hasn't changed since the comment was made. Secrets are available to this workflow! 💫
  7. The pull request status check is updated to reflect the success or failure of the integration test workflow.

Note that this sequence also works for branch based pull requests, as you'd expect!

Authentication

Choose one of these authentication methods for the repository_dispatch helper action, peter-evans/slash-command-dispatch, in ok-to-test.yml:

GitHub Apps have distinct identities on GitHub – no seat taken up by a machine account, no potential for leaking your personal credentials, and no rate limit sharing!

Credits

Contributing

Pull requests are welcome!

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].