@@ -22,10 +22,95 @@ jobs:
2222 runs-on : ubuntu-latest
2323
2424 steps :
25- - name : Checkout
26- uses : actions/checkout
25+ - name : Identify Workflow Branch
26+ run : |
27+ echo "Workflow branch ref: ${{ github.ref }}"
2728
28- - name : Show Help Information
29- uses : ./.github/ actions/help-command
29+ - name : Show Available Commands
30+ uses : actions/github-script@v7
3031 with :
31- github-token : ${{ secrets.GITHUB_TOKEN }}
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+ '**Required Environment Secrets:**',
50+ '- `CPLN_TOKEN_STAGING`: Control Plane authentication token',
51+ '- `CPLN_TOKEN_PRODUCTION`: Control Plane authentication token',
52+ '',
53+ '**Required GitHub Actions Variables:**',
54+ '- `CPLN_ORG_STAGING`: Control Plane authentication token',
55+ '- `CPLN_ORG_PRODUCTION`: Control Plane authentication token',
56+ '',
57+ '**Required GitHub Actions Variables (these need to match your control_plane.yml file:**',
58+ '- `PRODUCTION_APP_NAME`: Control Plane production app name',
59+ '- `STAGING_APP_NAME`: Control Plane staging app name',
60+ '- `REVIEW_APP_PREFIX`: Control Plane review app prefix',
61+ '',
62+ '**Optional Configuration:**',
63+ '- `WAIT_TIMEOUT`: Deployment timeout in seconds (default: 900)',
64+ ' - Must be a positive integer',
65+ ' - Can be set in GitHub Actions variables',
66+ ' - Applies to both deployment and workload readiness checks',
67+ '',
68+ '### `/delete-review-app`',
69+ 'Deletes the review app associated with this PR.',
70+ '- Removes all resources from Control Plane',
71+ '- Helpful for cleaning up when you\'re done testing',
72+ '- Can be re-deployed later using `/deploy-review-app`',
73+ '',
74+ '**Required Environment Variables:**',
75+ '- `CPLN_TOKEN`: Control Plane authentication token',
76+ '- `CPLN_ORG`: Control Plane organization name',
77+ '',
78+ '### `/help`',
79+ 'Shows this detailed help message.',
80+ '',
81+ '---',
82+ '## Environment Setup',
83+ '',
84+ '1. Set required secrets in your repository settings:',
85+ ' - `CPLN_TOKEN`',
86+ ' - `CPLN_ORG`',
87+ '',
88+ '2. Optional: Configure `WAIT_TIMEOUT` in GitHub Actions variables to customize deployment timeout',
89+ '',
90+ '## Control Plane Integration',
91+ '',
92+ 'Review apps are deployed to Control Plane with the following configuration:',
93+ '- App Name Format: `qa-react-webpack-rails-tutorial-pr-{PR_NUMBER}`',
94+ '- Console URL: `https://console.cpln.io/console/org/{CPLN_ORG}/gvc/{APP_NAME}/-info`',
95+ '',
96+ '## Automatic Cleanup',
97+ '',
98+ 'Review apps are automatically deleted when:',
99+ '- The PR is closed (merged or not merged)',
100+ '- The PR is stale (via nightly cleanup job)',
101+ '',
102+ 'For more information, see the [React on Rails Tutorial documentation](https://github.com/shakacode/react-on-rails/tree/master/react-webpack-rails-tutorial)'
103+ ].join('\n');
104+
105+ await github.rest.issues.createComment({
106+ owner: context.repo.owner,
107+ repo: context.repo.repo,
108+ issue_number: context.issue.number,
109+ body: helpMessage
110+ });
111+
112+ console.log('Help message posted successfully');
113+ } catch (error) {
114+ console.error('Error posting help message:', error);
115+ core.setFailed(`Failed to post help message: ${error.message}`);
116+ }
0 commit comments