Skip to content

Commit 99677b2

Browse files
committed
add gh-action skill
1 parent 49fb013 commit 99677b2

5 files changed

Lines changed: 369 additions & 0 deletions

File tree

skills/_artifacts/domain_map.yaml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,81 @@ skills:
572572
status: 'active'
573573
skills: ['self-hosting']
574574

575+
- name: 'Use GitHub Action'
576+
slug: 'gh-action'
577+
domain: 'integration'
578+
description: 'Use the "Preview in LiveCodes" GitHub Action to generate preview playground links for pull request code changes'
579+
type: 'composition'
580+
covers:
581+
- 'Workflow file setup (livecodes-preview.yml)'
582+
- 'Comment workflow (livecodes-post-comment.yml)'
583+
- 'Playground configuration JSON files'
584+
- 'Dynamic values (LC::REF, LC::SHA, etc.)'
585+
- 'File placeholders (TO_URL, TO_DATA_URL)'
586+
- 'Deploy preview strategies'
587+
tasks:
588+
- 'Set up GitHub Action workflow'
589+
- 'Configure playground JSON files'
590+
- 'Use dynamic values in configurations'
591+
- 'Link deployed assets to playgrounds'
592+
failure_modes:
593+
- mistake: 'Workflow files not on default branch'
594+
mechanism: 'GitHub Actions workflow_run event requires workflow files to be on default branch before PRs can trigger them'
595+
wrong_pattern: |
596+
# Creating PR with workflow files in same PR
597+
# Action won't run until merged to default branch
598+
correct_pattern: |
599+
# First merge workflow files to default branch
600+
git checkout main
601+
git merge feature/add-gh-action
602+
git push
603+
# Now PRs can trigger the action
604+
source: 'GitHub Actions documentation on workflow_run event'
605+
priority: 'HIGH'
606+
status: 'active'
607+
skills: ['gh-action']
608+
609+
- mistake: 'Missing permissions for PR comments'
610+
mechanism: 'Comment workflow needs pull-requests: write permission to post comments'
611+
wrong_pattern: |
612+
jobs:
613+
upload:
614+
runs-on: ubuntu-latest
615+
# Missing permissions!
616+
correct_pattern: |
617+
jobs:
618+
upload:
619+
runs-on: ubuntu-latest
620+
permissions:
621+
pull-requests: write # Required!
622+
source: 'GitHub Actions permissions'
623+
priority: 'MEDIUM'
624+
status: 'active'
625+
skills: ['gh-action']
626+
627+
- mistake: 'Using data URLs for large files'
628+
mechanism: 'Data URLs stored at dpaste.com have 1M character limit; large builds will fail'
629+
wrong_pattern: |
630+
{
631+
"imports": {
632+
"my-lib": "{{LC::TO_DATA_URL(./dist/bundle.js)}}" // Too large!
633+
}
634+
}
635+
correct_pattern: |
636+
# Use base-url and TO_URL for large files
637+
# In workflow:
638+
base-url: "https://{{LC::REF}}.my-project.pages.dev"
639+
# In project JSON:
640+
{
641+
"imports": {
642+
"my-lib": "{{LC::TO_URL(./dist/bundle.js)}}"
643+
}
644+
}
645+
source: 'Action: dpaste.com limits'
646+
priority: 'MEDIUM'
647+
status: 'active'
648+
skills: ['gh-action']
649+
575650
- name: 'Import and Export Code'
576651
slug: 'import-export'
577652
domain: 'configuration'

skills/_artifacts/skill_spec.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ LiveCodes is a feature-rich, open-source, client-side code playground that runs
2727
| testing | core | languages | Jest, Testing Library, watch mode, running tests programmatically | 0 |
2828
| markdown-integration | composition | integration | remark-livecodes, markdown-it-livecodes, Docusaurus, Astro, VitePress | 0 |
2929
| self-hosting | composition | integration | Deploying to static servers, Docker, BASE_URL, SDK appUrl config | 1 |
30+
| gh-action | composition | integration | Preview in LiveCodes GitHub Action, PR comments, workflow setup | 3 |
3031
| import-export | core | configuration | GitHub/GitLab imports, URL imports, DOM imports, export formats | 0 |
3132
| getting-started | lifecycle | - | Quick start for standalone, embedding, and self-hosting | 0 |
3233

@@ -99,6 +100,14 @@ LiveCodes is a feature-rich, open-source, client-side code playground that runs
99100
| --- | ------------------------------------------------- | -------- | ---------------------------------------- | ------------ |
100101
| 1 | Not configuring BASE_URL for subdirectory hosting | MEDIUM | Documentation: features/self-hosting.mdx | self-hosting |
101102

103+
### gh-action (3 failure modes)
104+
105+
| # | Mistake | Priority | Source | Cross-skill |
106+
| --- | ------------------------------------ | -------- | ---------------------------------- | ----------- |
107+
| 1 | Workflow files not on default branch | HIGH | GitHub Actions: workflow_run event | gh-action |
108+
| 2 | Missing permissions for PR comments | MEDIUM | GitHub Actions: permissions | gh-action |
109+
| 3 | Using data URLs for large files | MEDIUM | Action: dpaste.com limits | gh-action |
110+
102111
## Tensions
103112

104113
| Tension | Skills | Agent implication |

skills/_artifacts/skill_tree.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,3 +225,16 @@ skills:
225225
- 'sdk-embedding'
226226
sources:
227227
- 'live-codes/livecodes:docs/docs/features/self-hosting.mdx'
228+
229+
- name: 'Use GitHub Action'
230+
slug: 'gh-action'
231+
type: 'composition'
232+
domain: 'integration'
233+
path: 'skills/gh-action/SKILL.md'
234+
description: >
235+
Use the "Preview in LiveCodes" GitHub Action to generate preview playground links
236+
for pull request code changes. Automates playground creation and PR comments.
237+
requires: []
238+
sources:
239+
- 'live-codes/preview-in-livecodes:README.md'
240+
- 'live-codes/livecodes:docs/docs/gh-action.mdx'

skills/livecodes/SKILL.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ LiveCodes is a feature-rich, open-source, client-side code playground that runs
3434
| Use with React, Vue, Svelte, Solid, Preact | [livecodes/framework-wrappers/SKILL.md](./framework-wrappers/SKILL.md) |
3535
| Integrate with docs sites (Docusaurus, Astro) | [livecodes/markdown-integration/SKILL.md](./markdown-integration/SKILL.md) |
3636
| Self-host on your own server | [livecodes/self-hosting/SKILL.md](./self-hosting/SKILL.md) |
37+
| Preview PRs in LiveCodes (GitHub Action) | [livecodes/gh-action/SKILL.md](./gh-action/SKILL.md) |
3738

3839
## Quick Decision Tree
3940

@@ -76,6 +77,9 @@ Need to add playgrounds to markdown docs?
7677
7778
Need to host LiveCodes on your own server?
7879
→ livecodes/self-hosting
80+
81+
Need to preview PR changes in playgrounds?
82+
→ livecodes/gh-action
7983
```
8084

8185
## Minimal Working Example

0 commit comments

Comments
 (0)