|
1 | | -# VS Code Server Action |
2 | | - |
3 | | -> A GitHub Action that allows to debug GitHub workflows using VS Code. |
4 | | -
|
5 | | -Failing CI builds can be annoying especially since we don't have access to the machines that run them. While tests might pass locally for you, they still can fail in the CI environment. |
6 | | - |
7 | | -This GitHub Action helps to debug these problems by registering a VS Code Server instance on the CI machine that allows you to connect with the machine in case the build fails. |
8 | | - |
9 | | - |
| 1 | +# Setup code-server |
10 | 2 |
|
11 | 3 | ## Usage |
12 | 4 |
|
13 | | -In your GitHub workflow add the following step at the end of all steps: |
| 5 | +👇 This demo workflow will install code-server and then start a new VS Code web |
| 6 | +IDE instance that you can view using something like [ngrok] or [cloudflared]. |
| 7 | +Check out the [other @cidebug actions] like [setup-ngrok] or [setup-cloudflared] |
14 | 8 |
|
15 | | -```yaml |
| 9 | +```yml |
| 10 | +on: push |
16 | 11 | jobs: |
17 | | - test: |
18 | | - name: Test |
| 12 | + code-server: |
19 | 13 | runs-on: ubuntu-latest |
20 | | - # make sure these permissions are set so that |
21 | | - # VS Code can connect to the machine |
22 | | - permissions: |
23 | | - actions: read |
24 | | - contents: read |
25 | 14 | steps: |
26 | | - # ... |
27 | | - - name: 🐛 Debug Build |
28 | | - uses: stateful/vscode-server-action@v1 |
29 | | - if: failure() |
30 | | - with: |
31 | | - machineName: myMachine # optional, default: GitHub workflow run ID |
32 | | - timeout: '30000' # optional, default: 30000 |
33 | | -``` |
34 | | -
|
35 | | -In case your build fails the action attempts to start a VS Code Server on the build machine and requests you to authorize it: |
36 | | -
|
37 | | -``` |
38 | | -To grant access to the server, please log into https://github.com/login/device and use code 0328-F81A |
| 15 | + - uses: cidebug/setup-code-server@v1 |
| 16 | + - run: code-server |
39 | 17 | ``` |
40 | 18 |
|
41 | | -If you don't authorize the machine until the `timeout` was hit the build just continues. Once authorized through a VS Code Server is started and it prints an URL to connect to, e.g.: |
| 19 | +After code-server has been setup, you can run it like this: |
42 | 20 |
|
| 21 | +```sh |
| 22 | +code-server |
43 | 23 | ``` |
44 | | -Open this link in your browser https://vscode.dev/tunnel/myMachine/github/workspace |
45 | | -``` |
46 | | - |
47 | | -You can also connect to it through your local VS Code application. Just open the URL, open the command palette and enter `Open in VS Code`. |
48 | | - |
49 | | -## Inputs |
50 | | - |
51 | | -- `machineName` (optional): name of the machine to access (default: GitHub Action run id) |
52 | | -- `timeout` (optional): the time until the action continues the build if the machine does not get authorized (default: 30s) |
53 | | - |
54 | | -## Contribute |
55 | | - |
56 | | -Simply raise a pull request 🙂 Make sure CI passes and then you should be good to go. |
57 | 24 |
|
| 25 | +📚 Make sure you check out the code-server documentation for a full account of |
| 26 | +all the options that you can play around with! |
0 commit comments