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