remove separate action #61
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Show Help for Commands | |
on: | |
push: | |
branches: | |
- "**" # Trigger on all branches, including feature branches | |
issue_comment: | |
types: [created] | |
workflow_dispatch: | |
inputs: | |
issue-number: | |
description: 'PR/Issue number to post the help comment to' | |
required: true | |
type: number | |
permissions: | |
issues: write | |
pull-requests: write | |
jobs: | |
show-help: | |
if: | | |
github.event_name == 'workflow_dispatch' || | |
(github.event_name == 'issue_comment' && | |
github.event.issue.pull_request && | |
github.event.comment.body == '/help') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout | |
- name: Show Help Information | |
uses: actions/github-script | |
with: | |
github-token: ${{ secrets.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 = context.payload.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); | |
} |