-
Notifications
You must be signed in to change notification settings - Fork 5
Polish review app command UX before 5.0.0 stable #285
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
c5a8279
8f6bbeb
08ac574
9a5ecbf
afcc2c1
1328734
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,32 +1,49 @@ | ||||||
| # Control Plane GitHub Flow | ||||||
| # Review app help | ||||||
|
|
||||||
| You asked for review app help. These commands are generated by [cpflow](https://github.com/shakacode/control-plane-flow). | ||||||
|
|
||||||
| ## PR commands | ||||||
|
|
||||||
| `/deploy-review-app` | ||||||
| `+review-app-deploy` | ||||||
| - Creates the review app if it does not exist | ||||||
| - Builds the PR commit image | ||||||
| - Deploys the image and comments with the review URL | ||||||
| - Comment body must be exactly `/deploy-review-app` — no surrounding text, trailing whitespace, or trailing newline. The trigger uses an exact-equality match, so a comment like `please /deploy-review-app now` or `/deploy-review-app ` (with a trailing space) silently no-ops. | ||||||
| - Comment body must be exactly `+review-app-deploy`, with no surrounding text or trailing spaces. A single trailing newline from GitHub's comment editor is accepted. Comments like `please +review-app-deploy now` or `+review-app-deploy ` (with a trailing space) silently no-op. | ||||||
|
|
||||||
| `/delete-review-app` | ||||||
| `+review-app-delete` | ||||||
| - Deletes the review app when the PR is done | ||||||
| - This also runs automatically when the PR closes | ||||||
| - Same exact-match rule as `/deploy-review-app`: the comment body must be exactly `/delete-review-app`. | ||||||
| - Comment body must be exactly `+review-app-delete`, with no surrounding text or trailing spaces. A single trailing newline from GitHub's comment editor is accepted. Same command-match rule as `+review-app-deploy`. | ||||||
|
|
||||||
| `+review-app-help` | ||||||
| - Posts this message on the PR. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Minor punctuation inconsistency: this bullet ends with a period, but the equivalent first bullets under
Suggested change
|
||||||
| - Comment body must be exactly `+review-app-help`, with no surrounding text or trailing spaces. A single trailing newline from GitHub's comment editor is accepted. Same command-match rule as `+review-app-deploy`. | ||||||
|
|
||||||
| ## Workflow behavior | ||||||
|
|
||||||
| - Review apps are opt-in and created with `+review-app-deploy` | ||||||
| - New commits redeploy existing review apps automatically | ||||||
| - Pushes to the staging branch deploy staging automatically | ||||||
| - Promotion to production is manual via the Actions tab | ||||||
| - A nightly workflow removes stale review apps | ||||||
|
|
||||||
| <details> | ||||||
| <summary>Advanced: GitHub Actions secrets and variables</summary> | ||||||
|
|
||||||
| ## Repository secrets | ||||||
| ### GitHub Actions secrets | ||||||
|
|
||||||
| | Name | Required | Notes | | ||||||
| | --- | --- | --- | | ||||||
| | `CPLN_TOKEN_STAGING` | yes | Service-account token scoped to the staging org. | | ||||||
| | `CPLN_TOKEN_PRODUCTION` | yes (for promote) | Service-account token scoped to the production org. | | ||||||
| | `CPLN_TOKEN_STAGING` | yes | Service-account token scoped to the staging Control Plane org on controlplane.com. | | ||||||
| | `CPLN_TOKEN_PRODUCTION` | yes (for promote) | Service-account token scoped to the production Control Plane org on controlplane.com. | | ||||||
| | `DOCKER_BUILD_SSH_KEY` | optional | Private SSH key used when Docker builds fetch private deps via `RUN --mount=type=ssh`. | | ||||||
|
|
||||||
| ## Repository variables | ||||||
| ### GitHub Actions variables | ||||||
|
|
||||||
| | Name | Required | Notes | | ||||||
| | --- | --- | --- | | ||||||
| | `CPLN_ORG_STAGING` | yes | Control Plane org for staging and review apps. | | ||||||
| | `CPLN_ORG_PRODUCTION` | yes (for promote) | Control Plane org for production. | | ||||||
| | `CPLN_ORG_STAGING` | yes | Control Plane org on controlplane.com for staging and review apps. | | ||||||
| | `CPLN_ORG_PRODUCTION` | yes (for promote) | Control Plane org on controlplane.com for production. | | ||||||
| | `STAGING_APP_NAME` | yes | App name in `controlplane.yml` used as the staging deploy target. | | ||||||
| | `PRODUCTION_APP_NAME` | yes (for promote) | App name in `controlplane.yml` used as the production deploy target. | | ||||||
| | `REVIEW_APP_PREFIX` | yes | Prefix for per-PR review app names (e.g. `review-app`). | | ||||||
|
|
@@ -38,10 +55,19 @@ | |||||
| | `CPLN_CLI_VERSION` | optional | Pin a specific `@controlplane/cli` version; falls back to the action default when unset. | | ||||||
| | `CPFLOW_VERSION` | optional | Pin a specific cpflow gem version; falls back to the generated default when unset. | | ||||||
|
|
||||||
| ## Workflow behavior | ||||||
| </details> | ||||||
|
|
||||||
| - Review apps are opt-in and created with `/deploy-review-app` | ||||||
| - New commits redeploy existing review apps automatically | ||||||
| - Pushes to the staging branch deploy staging automatically | ||||||
| - Promotion to production is manual via the Actions tab | ||||||
| - A nightly workflow removes stale review apps | ||||||
| <details> | ||||||
| <summary>Advanced: testing changes to generated workflows</summary> | ||||||
|
|
||||||
| When iterating on the generated workflow YAML on a PR branch, comment-triggered runs (`+review-app-deploy`, `+review-app-delete`, `+review-app-help`) execute the workflow code from the repository's default branch — not your PR branch. To exercise the PR-branch workflow code before merging, dispatch the workflow manually with `gh`: | ||||||
|
|
||||||
| ```sh | ||||||
| gh workflow run cpflow-deploy-review-app.yml --ref <your-pr-branch> -f pr_number=<pr-number> | ||||||
| gh workflow run cpflow-delete-review-app.yml --ref <your-pr-branch> -f pr_number=<pr-number> | ||||||
| gh workflow run cpflow-help-command.yml --ref <your-pr-branch> -f pr_number=<pr-number> | ||||||
| ``` | ||||||
|
|
||||||
| `workflow_dispatch` runs use the workflow file from the `--ref` you pass, so this is the supported way to test PR-branch workflow edits before merge. After merge, comment triggers go back to running the default-branch workflow code as usual. | ||||||
|
|
||||||
| </details> | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,15 +37,15 @@ jobs: | |
| deploy: | ||
| # Skip synchronize/opened events from fork PRs at the job level — they cannot access | ||
| # repository secrets anyway, so running any steps just burns billable minutes. Users | ||
| # can still manually deploy a fork PR via `/deploy-review-app` (gated below by | ||
| # can still manually deploy a fork PR via `+review-app-deploy` (gated below by | ||
| # author_association) or workflow_dispatch. | ||
| if: | | ||
| (github.event_name == 'pull_request' && | ||
| github.event.pull_request.head.repo.full_name == github.repository) || | ||
| github.event_name == 'workflow_dispatch' || | ||
| (github.event_name == 'issue_comment' && | ||
| github.event.issue.pull_request && | ||
| github.event.comment.body == '/deploy-review-app' && | ||
| contains(fromJson('["+review-app-deploy","+review-app-deploy\n","+review-app-deploy\r\n"]'), github.event.comment.body) && | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
| contains(fromJson('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association)) | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 45 | ||
|
|
@@ -236,7 +236,7 @@ jobs: | |
| run: | | ||
| { | ||
| echo "Review app ${APP_NAME} does not exist yet." | ||
| echo "Create it with a PR comment that is exactly /deploy-review-app." | ||
| echo "Create it with +review-app-deploy as the PR comment body." | ||
| } >> "$GITHUB_STEP_SUMMARY" | ||
|
|
||
| - name: Setup review app if it does not exist yet | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.