Skip to content

Commit 0536f3b

Browse files
committed
update to current branch for uses
1 parent ce0b7dd commit 0536f3b

8 files changed

+107
-98
lines changed
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: 'Show Help Command'
2+
description: 'Displays help information for available commands in PR comments'
3+
4+
inputs:
5+
github-token:
6+
description: 'GitHub token for posting comments'
7+
required: true
8+
9+
runs:
10+
using: "composite"
11+
steps:
12+
- name: Show Available Commands
13+
uses: actions/github-script@justin808-more-work-on-review-apps-1
14+
with:
15+
github-token: ${{ inputs.github-token }}
16+
script: |
17+
const helpText = [
18+
'# Available Commands',
19+
'',
20+
'## `/deploy`',
21+
'**Purpose:** Deploy a review app for your pull request',
22+
'',
23+
'**What it does:**',
24+
'- Creates a new review app in Control Plane',
25+
'- Deploys your changes to the review environment',
26+
'- Provides a unique URL to preview your changes',
27+
'- Shows build and deployment progress in real-time',
28+
'',
29+
'**Optional Configuration:**',
30+
'- `WAIT_TIMEOUT`: Deployment timeout in seconds (default: 900)',
31+
' - Must be a positive integer',
32+
' - Example: `/deploy timeout=1800`',
33+
'',
34+
'## `/destroy`',
35+
'**Purpose:** Remove the review app for your pull request',
36+
'',
37+
'**What it does:**',
38+
'- Deletes the review app from Control Plane',
39+
'- Cleans up associated resources',
40+
'- Updates PR with deletion status',
41+
'',
42+
'---',
43+
'## Environment Setup',
44+
'',
45+
'**Required Environment Secrets:**',
46+
'- `CPLN_TOKEN_STAGING`: Control Plane authentication token',
47+
'- `CPLN_TOKEN_PRODUCTION`: Control Plane authentication token',
48+
'',
49+
'**Required GitHub Actions Variables:**',
50+
'- `CPLN_ORG_STAGING`: Control Plane authentication token',
51+
'- `CPLN_ORG_PRODUCTION`: Control Plane authentication token',
52+
'',
53+
'**Required GitHub Actions Variables (these need to match your control_plane.yml file:**',
54+
'- `PRODUCTION_APP_NAME`: Control Plane production app name',
55+
'- `STAGING_APP_NAME`: Control Plane staging app name',
56+
'- `REVIEW_APP_PREFIX`: Control Plane review app prefix',
57+
'',
58+
'Optional: Configure `WAIT_TIMEOUT` in GitHub Actions variables to customize deployment timeout',
59+
'',
60+
'## Control Plane Integration',
61+
'',
62+
'1. Review app naming convention:',
63+
' ```',
64+
' ${{ vars.REVIEW_APP_PREFIX }}-<pr-number>',
65+
' ```',
66+
'2. Console URL: `https://console.cpln.io/console/org/{CPLN_ORG}/gvc/{APP_NAME}/-info`',
67+
'',
68+
'## Automatic Cleanup',
69+
'',
70+
'Review apps are automatically destroyed when:',
71+
'1. The pull request is closed',
72+
'2. The `/destroy` command is used',
73+
'3. A new deployment is requested (old one is cleaned up first)',
74+
'',
75+
'## Need Help?',
76+
'',
77+
'For additional assistance:',
78+
'1. Check the [Control Plane documentation](https://docs.controlplane.com/)',
79+
'2. Contact the infrastructure team',
80+
'3. Open an issue in this repository',
81+
].join('\n');
82+
83+
const context = github.context;
84+
if (context.eventName === 'issue_comment') {
85+
await github.rest.issues.createComment({
86+
owner: context.repo.owner,
87+
repo: context.repo.repo,
88+
issue_number: context.payload.issue.number,
89+
body: helpText
90+
});
91+
} else {
92+
console.log(helpText);
93+
}

.github/workflows/delete-review-app.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858
fi
5959
6060
- name: Setup Environment
61-
uses: ./.github/actions/setup-environment@justin808-working-for-deploys
61+
uses: ./.github/actions/setup-environment@justin808-more-work-on-review-apps-1
6262
with:
6363
org: ${{ env.CPLN_ORG }}
6464
token: ${{ env.CPLN_TOKEN }}
@@ -132,7 +132,7 @@ jobs:
132132
return { commentId: comment.data.id };
133133
134134
- name: Delete Review App
135-
uses: ./.github/actions/delete-control-plane-app@justin808-working-for-deploys
135+
uses: ./.github/actions/delete-control-plane-app@justin808-more-work-on-review-apps-1
136136
with:
137137
app_name: ${{ env.APP_NAME }}
138138
org: ${{ env.CPLN_ORG }}

.github/workflows/deploy-to-control-plane-staging.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
fetch-depth: 0 # Fetch all history for proper SHA handling
2727
ref: master # Explicitly checkout master branch
2828

29-
- uses: ./.github/actions/deploy-to-control-plane@justin808-working-for-deploys
29+
- uses: ./.github/actions/deploy-to-control-plane@justin808-more-work-on-review-apps-1
3030
with:
3131
app_name: ${{ vars.STAGING_APP_NAME }}
3232
org: ${{ vars.CPLN_ORG_STAGING }}

.github/workflows/deploy-to-control-plane.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || steps.getRef.outputs.PR_REF || github.ref }}
4141

4242
- name: Setup Environment
43-
uses: ./.github/actions/setup-environment@justin808-working-for-deploys
43+
uses: ./.github/actions/setup-environment@justin808-more-work-on-review-apps-1
4444
with:
4545
token: ${{ env.CPLN_TOKEN }}
4646
org: ${{ env.CPLN_ORG }}
@@ -228,7 +228,7 @@ jobs:
228228
github.event.issue.pull_request &&
229229
github.event.comment.body == '/deploy-review-app') ||
230230
(steps.check-app.outputs.app_exists == 'true')
231-
uses: ./.github/actions/build-docker-image@justin808-working-for-deploys
231+
uses: ./.github/actions/build-docker-image@justin808-more-work-on-review-apps-1
232232
with:
233233
app_name: ${{ env.APP_NAME }}
234234
org: ${{ env.CPLN_ORG }}
@@ -269,7 +269,7 @@ jobs:
269269
github.event.issue.pull_request &&
270270
github.event.comment.body == '/deploy-review-app') ||
271271
(steps.check-app.outputs.app_exists == 'true')
272-
uses: ./.github/actions/deploy-to-control-plane@justin808-working-for-deploys
272+
uses: ./.github/actions/deploy-to-control-plane@justin808-more-work-on-review-apps-1
273273
with:
274274
app_name: ${{ env.APP_NAME }}
275275
org: ${{ env.CPLN_ORG }}

.github/workflows/help-command.yml

Lines changed: 5 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -22,93 +22,10 @@ jobs:
2222
runs-on: ubuntu-latest
2323

2424
steps:
25-
- name: Identify Workflow Branch
26-
run: |
27-
echo "Workflow branch ref: ${{ github.ref }}"
25+
- name: Checkout
26+
uses: actions/checkout@justin808-more-work-on-review-apps-1
2827

29-
- name: Show Available Commands
30-
uses: actions/github-script@v7
28+
- name: Show Help Information
29+
uses: ./.github/actions/help-command@justin808-more-work-on-review-apps-1
3130
with:
32-
script: |
33-
try {
34-
console.log('Creating detailed help message...');
35-
const helpMessage = [
36-
'# 📚 Detailed Review App Commands Guide',
37-
'',
38-
'This is a detailed guide to using review app commands. For a quick reference, see the message posted when your PR was created.',
39-
'',
40-
'## Available Commands',
41-
'',
42-
'### `/deploy-review-app`',
43-
'Deploys your PR branch to a review environment on Control Plane.',
44-
'- Creates a new review app if one doesn\'t exist',
45-
'- Updates the existing review app if it already exists',
46-
'- Provides a unique URL to preview your changes',
47-
'- Shows build and deployment progress in real-time',
48-
'',
49-
'**Optional Configuration:**',
50-
'- `WAIT_TIMEOUT`: Deployment timeout in seconds (default: 900)',
51-
' - Must be a positive integer',
52-
' - Can be set in GitHub Actions variables',
53-
' - Applies to both deployment and workload readiness checks',
54-
'',
55-
'### `/delete-review-app`',
56-
'Deletes the review app associated with this PR.',
57-
'- Removes all resources from Control Plane',
58-
'- Helpful for cleaning up when you\'re done testing',
59-
'- Can be re-deployed later using `/deploy-review-app`',
60-
'',
61-
'**Required Environment Variables:**',
62-
'- `CPLN_TOKEN`: Control Plane authentication token',
63-
'- `CPLN_ORG`: Control Plane organization name',
64-
'',
65-
'### `/help`',
66-
'Shows this detailed help message.',
67-
'',
68-
'---',
69-
'## Environment Setup',
70-
'',
71-
'**Required Environment Secrets:**',
72-
'- `CPLN_TOKEN_STAGING`: Control Plane authentication token',
73-
'- `CPLN_TOKEN_PRODUCTION`: Control Plane authentication token',
74-
'',
75-
'**Required GitHub Actions Variables:**',
76-
'- `CPLN_ORG_STAGING`: Control Plane authentication token',
77-
'- `CPLN_ORG_PRODUCTION`: Control Plane authentication token',
78-
'',
79-
'**Required GitHub Actions Variables (these need to match your control_plane.yml file:**',
80-
'- `PRODUCTION_APP_NAME`: Control Plane production app name',
81-
'- `STAGING_APP_NAME`: Control Plane staging app name',
82-
'- `REVIEW_APP_PREFIX`: Control Plane review app prefix',
83-
'',
84-
Optional: Configure `WAIT_TIMEOUT` in GitHub Actions variables to customize deployment timeout',
85-
'',
86-
'## Control Plane Integration',
87-
'',
88-
'1. Review app naming convention:',
89-
' ```',
90-
' ${{ vars.REVIEW_APP_PREFIX }}-<pr-number>',
91-
' ```',
92-
'2. Console URL: `https://console.cpln.io/console/org/{CPLN_ORG}/gvc/{APP_NAME}/-info`',
93-
'',
94-
'## Automatic Cleanup',
95-
'',
96-
'Review apps are automatically deleted when:',
97-
'- The PR is closed (merged or not merged)',
98-
'- The PR is stale (via nightly cleanup job)',
99-
'',
100-
'For more information, see the [React on Rails Tutorial documentation](https://github.com/shakacode/react-on-rails/tree/master/react-webpack-rails-tutorial)'
101-
].join('\n');
102-
103-
await github.rest.issues.createComment({
104-
owner: context.repo.owner,
105-
repo: context.repo.repo,
106-
issue_number: context.issue.number,
107-
body: helpMessage
108-
});
109-
110-
console.log('Help message posted successfully');
111-
} catch (error) {
112-
console.error('Error posting help message:', error);
113-
core.setFailed(`Failed to post help message: ${error.message}`);
114-
}
31+
github-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/nightly-remove-stale-review-apps.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
uses: actions/checkout@v4
2020

2121
- name: Setup Environment
22-
uses: ./.github/actions/setup-environment@justin808-working-for-deploys
22+
uses: ./.github/actions/setup-environment@justin808-more-work-on-review-apps-1
2323

2424
- name: Get Stale PRs
2525
id: stale_prs

.github/workflows/promote-staging-to-production.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
uses: actions/checkout@v4
2424

2525
- name: Setup Environment
26-
uses: ./.github/actions/setup-environment@justin808-working-for-deploys
26+
uses: ./.github/actions/setup-environment@justin808-more-work-on-review-apps-1
2727
env:
2828
CPLN_TOKEN: ${{ secrets.CPLN_TOKEN }}
2929

.github/workflows/review-app-help.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,9 @@ jobs:
3232
'Remove the review app when done',
3333
'',
3434
'### `/help`',
35-
'Show detailed documentation',
35+
'Show detailed instructions, environment setup, and configuration options.'
3636
'',
3737
'---',
38-
'**Note:** Type `/help` for detailed instructions, environment setup, and configuration options.'
3938
].join('\n');
4039
4140
await github.rest.issues.createComment({

0 commit comments

Comments
 (0)