Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move images into static folder. #1409

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added docs/_static_/images/ci-copy-fork-branch.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_static_/images/ci-tests-running.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions docs/contributing/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ There are three main parties:
2. The Electron app with Reactotron's UI, which subscribes to app updates
3. The app client that we are debugging, which sends commands with information about the app to the server

<img src="./images/architecture-app-mobile-diagram.png" alt="Diagram of the Reactotron Electron app, reactotron-core-server, and the app client" />
<img src="images/architecture-app-mobile-diagram.png" alt="Diagram of the Reactotron Electron app, reactotron-core-server, and the app client" />

Websockets are used to sends "commands", which are JSON objects with information about the app we are debugging. The payloads are sent to the server, which then publishes them to all subscribers (like the Electron app).

## Workspaces

This repository is broken into different workspaces:

<img src="./images/architecture-workspace-chart.png" alt="Diagram of the Reactotron electron app and client, and which workspaces they correspond to." />
<img src="images/architecture-workspace-chart.png" alt="Diagram of the Reactotron electron app and client, and which workspaces they correspond to." />

### Reactotron app

Expand Down
48 changes: 48 additions & 0 deletions docs/contributing/running-scripts-from-untrusted-forks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
name: Running Tests on Untrusted Forks
sidebar_position: 99
---

# Running CI Scripts on Untrusted Forks

Untrusted forks could contain malicious code to mine cryptocurrency, steal secrets, or otherwise harm the CI server.

For PRs from untrusted forks, to run the CI scripts, we need to:

1. Review the code to ensure that it is safe to run on the CI server.
2. If the code is safe, run the `ci:trust` script to push the commits to a branch on the main repository, where the CI scripts can be run.
3. Once the tests have run, the status of the PR will be updated automatically (because the commits are the same).


## How to run the CI scripts on untrusted forks:

1. Copy the name of the branch from the PR.
<img src="images/ci-copy-fork-branch.png" alt="ci-copy-fork-branch" width="400"/>
2. From your local clone of the main repository, run the `ci:trust` script.
```bash
yarn ci:trust <branch-name>
```
3. The branch will be pushed and the tests will run
<img src="images/ci-tests-running.png" alt="ci-tests-running" width="400"/>


## What does ci:trust do?

The `ci:trust` script does the following:

1. Adds and fetches the untrusted fork as a temporary remote in your local repository.
2. Pushes the specific branch from the untrusted fork to a designated temporary branch in your original repository.
3. Pushing to a local branch triggers the continuous integration (CI) tests on the commits of the branch.
4. Because the commits are the same, the status of the PR will be updated automatically.


### Notes
1. The ci:trust script will only work if you have write access to the main repository. This prevents malicious users from running the script on the main repository.
2. The ci:trust script pushes the commits to a branch called `temp-branch-to-test-fork`.

::: warning

The `temp-branch-to-test-fork` branch will be deleted and recreated if it already exists. This allows the script to
clean up its own temporary branches.

:::