Skip to content

Commit

Permalink
Using Codespaces README update (#9179)
Browse files Browse the repository at this point in the history
* initial codespaces docs and screenshot

* add new screenshots

* more codespaces notes
add info about exporting token first before npm start
add more screenshots
add working with branches section
add notes about limits
  • Loading branch information
jazzsequence authored Aug 28, 2024
1 parent 51fd0b7 commit 48e8ab6
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,35 @@ Alternatively, if you'd rather create a classic-style token:
GITHUB_API=$TOKENHASH
```
## Using GitHub Codespaces
A [GitHub Codespace](https://github.com/features/codespaces) can be used to test the site as well. To set up a Codespace, navigate to the branch you want to use as the base (e.g. `main`) and click the Code dropdown.
![Codespaces screenshot](/source/images/assets/codespaces-setup.png)
This will take you to a VSCode-like interface with a Terminal window. From here, export your GitHub API token you created in the previous step using the following command (replacing `$TOKENHASH` with your API token):
```bash{promptUser: user}
export GITHUB_API=$TOKENHASH
```
Now you can run `npm ci` and `npm start` in the Terminal panel at the bottom of the page. The docs site will build inside the Codespaces container and install Node dependencies just like it would on your local machine. When the Node server is running, a dialog box will appear at the bottom right corner asking if you want to open the Codespace in a browser and if you want to make the Codespace public.
![Codespaces open in browser](/source/images/assets/codespaces-application-available.png)
Clicking on the link will take you to a live site that's running on the current branch of the repository. If you opted to make the Codespace public, you can share the link to others and they will be able to view the site after accepting a warning that they are visiting someone else's Codespace. If the Codespace was not made public, only your GitHub user will be able to see it.
### Working with branches on Codespaces
You can open a Codespace (or load an existing Codespace) on a particular branch by first navigating to that branch in the GitHub repository. Alternately, if you already have the VSCode editor open, you can select a specific branch by clicking the branch name at the bottom left, then selecting the branch you would like to switch to in the panel that appears at the top of the screen. The Codespace will make the necessary adjustments and rebuild the docs site on that branch.
![Codespaces branch](/source/images/assets/codespaces-branch.png)
![Codespaces branch selection](/source/images/assets/codespaces-branch-list.png)
### Notes on running in Codespaces
Codespaces is free for individuals for [60 hours of runtime for 2 cores](https://github.com/features/codespaces#pricing), after which your _user_ is billed for additional time. It's unclear whether Pantheon's Enterprise account would own billing, but as of this writing it appears to be billed on a per user basis. For this reason, it's important to _not leave your Codespaces running_ when you're done with them.
## Install With The Gatsby Cli
From the `documentation` directory:
Expand Down
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 source/images/assets/codespaces-branch-list.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 source/images/assets/codespaces-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 source/images/assets/codespaces-setup.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 48e8ab6

Please sign in to comment.