-
Notifications
You must be signed in to change notification settings - Fork 16
Migrate action runtime to Go with tests and live deploy path #111
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
Changes from all commits
4f8443f
81a060c
2844126
3bc9583
c4cce5a
7166598
114c54a
204656d
bd10d2a
58d9e83
0ecd8e7
23167e1
ac9244a
283b3de
89ce1e4
95ee049
ae7de53
edc72e3
8c53876
2fa481e
4bc443a
b397f66
696cdf8
4c37221
3942456
560e0f2
de6d03e
54bfb78
70af287
0f42a86
2d3f75d
62c36ec
3eead75
2417f02
e08f4a5
c362524
56156d3
1b26c26
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| [submodule "wiki"] | ||
| path = wiki | ||
| url = https://github.com/pullpreview/action.wiki.git |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1 +1 @@ | ||||||
| ruby 3.1.6 | ||||||
| go 1.25.1 | ||||||
|
||||||
| go 1.25.1 | |
| go 1.23.1 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| # PullPreview Action — Current Behavior (Go) | ||
|
|
||
| This repository ships a GitHub Action implemented in Go. | ||
|
|
||
| ## Runtime | ||
| - Action definition: `action.yml` | ||
| - Action type: `composite` | ||
| - Runtime binary: prebuilt amd64 Linux artifact in `dist/` | ||
| - No Docker image build is required during action execution. | ||
|
|
||
| ## Go Tooling | ||
| - Go commands should be run via `mise` for toolchain consistency. | ||
| - Examples: | ||
| - `mise exec -- go test ./...` | ||
| - `mise exec -- go run ./cmd/pullpreview up examples/example-app` | ||
| - `make dist` | ||
| - Dist workflow: | ||
| - Commit source changes first. | ||
| - Run `make dist` afterwards. | ||
| - `make dist` auto-commits the updated bundled binary with a standard commit message. | ||
| - Before merging, `make rewrite` can rewrite the current branch and drop dist-only auto-commits (force-push required). | ||
|
|
||
| ## CLI | ||
| Entrypoint source is `cmd/pullpreview/main.go`. | ||
|
|
||
| Supported commands: | ||
| - `pullpreview up path/to/app` | ||
| - `pullpreview down --name <instance>` | ||
| - `pullpreview list org/repo` | ||
| - `pullpreview github-sync path/to/app` | ||
|
|
||
| ## Deploy behavior (`up`) | ||
| - Tars app directory (excluding `.git`). | ||
| - Launches/restores Lightsail instance and waits for SSH. | ||
| - Uploads authorized keys, update script, and pre-script. | ||
| - Deploys through Docker context to the remote engine. | ||
| - Rewrites relative bind mounts under `app_path` so they resolve on the remote host. | ||
| - Optional automatic HTTPS proxying via Caddy + Let's Encrypt when `proxy_tls` is set. | ||
| - Format: `service:port` (for example `web:80`). | ||
| - Forces preview URL/output to HTTPS on port `443`. | ||
| - Opens firewall port `443` and suppresses firewall exposure for port `80`. | ||
| - Injects `pullpreview-proxy` service unless host port `443` is already published (then it logs a warning and skips proxy injection). | ||
| - Emits periodic heartbeat logs with: | ||
| - preview URL | ||
| - SSH command (`ssh user@ip`) | ||
| - authorized users info | ||
| - key-upload confirmation | ||
|
|
||
| ## GitHub sync behavior (`github-sync`) | ||
| - Handles PR labeled/opened/reopened/synchronize/unlabeled/closed events. | ||
| - Handles push events for `always_on` branches. | ||
| - Handles scheduled cleanup of dangling labeled preview instances. | ||
| - Updates marker-based PR status comments. | ||
| - For `admins: "@collaborators/push"`: | ||
| - loads collaborators from GitHub REST API with `affiliation=all` + `permission=push` | ||
| - uses only the first page (up to 100 users) | ||
| - emits a warning if additional pages exist | ||
| - fetches each admin's SSH public keys via GitHub API and forwards keys to the instance | ||
| - uses local key cache directory (`PULLPREVIEW_SSH_KEYS_CACHE_DIR`) to avoid refetching keys across runs | ||
| - Always posts/updates marker-based PR status comments per environment/job with building/ready/error/destroyed state and preview URL. | ||
|
|
||
| ## Action inputs/outputs | ||
| - Existing inputs are preserved. | ||
| - Additional input: | ||
| - `proxy_tls` (`service:port`, default empty) | ||
| - Outputs: | ||
| - `url` | ||
| - `host` | ||
| - `username` | ||
|
|
||
| ## Key directories | ||
| - `cmd/pullpreview`: CLI | ||
| - `internal/pullpreview`: core orchestration | ||
| - `internal/providers/lightsail`: Lightsail provider | ||
| - `internal/github`: GitHub API wrapper | ||
| - `internal/license`: license check client | ||
| - `dist/`: bundled Linux amd64 binary used by the action | ||
|
|
||
| ## Repo-local skill | ||
| - `skills/pullpreview-demo-flow/SKILL.md`: repeatable end-to-end demo capture workflow (PR open/label/deploy/view deployment/unlabel/destroy) with strict screenshot requirements and fixed demo PR title. |
This file was deleted.
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.