Skip to content

Commit 48e8ab6

Browse files
authored
Using Codespaces README update (#9179)
* 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
1 parent 51fd0b7 commit 48e8ab6

File tree

5 files changed

+29
-0
lines changed

5 files changed

+29
-0
lines changed

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,35 @@ Alternatively, if you'd rather create a classic-style token:
8080
GITHUB_API=$TOKENHASH
8181
```
8282
83+
## Using GitHub Codespaces
84+
85+
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.
86+
87+
![Codespaces screenshot](/source/images/assets/codespaces-setup.png)
88+
89+
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):
90+
91+
```bash{promptUser: user}
92+
export GITHUB_API=$TOKENHASH
93+
```
94+
95+
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.
96+
97+
![Codespaces open in browser](/source/images/assets/codespaces-application-available.png)
98+
99+
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.
100+
101+
### Working with branches on Codespaces
102+
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.
103+
104+
![Codespaces branch](/source/images/assets/codespaces-branch.png)
105+
106+
![Codespaces branch selection](/source/images/assets/codespaces-branch-list.png)
107+
108+
### Notes on running in Codespaces
109+
110+
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.
111+
83112
## Install With The Gatsby Cli
84113
85114
From the `documentation` directory:
38.4 KB
Loading
200 KB
Loading
25.5 KB
Loading
111 KB
Loading

0 commit comments

Comments
 (0)