Skip to content

Commit 8aca18e

Browse files
committed
wip
1 parent 9bc9a6a commit 8aca18e

File tree

2 files changed

+13
-69
lines changed

2 files changed

+13
-69
lines changed

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

+13-27
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,11 @@ jobs:
6060
}
6161
`);
6262
63-
- name: Initialize Delete
64-
id: init-delete
63+
- name: Initialize and Set Workflow URL
64+
id: init-workflow
6565
uses: actions/github-script@v7
6666
with:
6767
script: |
68-
eval(process.env.GET_CONSOLE_LINK);
69-
7068
async function getWorkflowUrl(runId) {
7169
// Get the current job ID
7270
const jobs = await github.rest.actions.listJobsForWorkflowRun({
@@ -87,34 +85,16 @@ jobs:
8785
}
8886
8987
const workflowUrl = await getWorkflowUrl(context.runId);
90-
91-
const comment = await github.rest.issues.createComment({
92-
issue_number: process.env.PR_NUMBER,
93-
owner: context.repo.owner,
94-
repo: context.repo.repo,
95-
body: [
96-
' Starting app deletion...',
97-
'',
98-
' [View Delete Logs](' + workflowUrl + ')',
99-
'',
100-
getConsoleLink(process.env.PR_NUMBER)
101-
].join('\n')
102-
});
103-
104-
return {
105-
commentId: comment.data.id,
106-
workflowUrl
107-
};
108-
109-
- name: Set workflow URL
110-
run: |
111-
echo "WORKFLOW_URL=${{ fromJSON(steps.init-delete.outputs.result).workflowUrl }}" >> $GITHUB_ENV
88+
core.exportVariable('WORKFLOW_URL', workflowUrl);
89+
return { workflowUrl };
11290
11391
- name: Create Initial Delete Comment
11492
id: init-delete
11593
uses: actions/github-script@v7
11694
with:
11795
script: |
96+
eval(process.env.GET_CONSOLE_LINK);
97+
11898
let message = '🗑️ Starting app deletion';
11999
if ('${{ github.event_name }}' === 'pull_request') {
120100
const merged = '${{ github.event.pull_request.merged }}' === 'true';
@@ -125,7 +105,13 @@ jobs:
125105
issue_number: process.env.PR_NUMBER,
126106
owner: context.repo.owner,
127107
repo: context.repo.repo,
128-
body: message
108+
body: [
109+
message,
110+
'',
111+
' [View Delete Logs](' + process.env.WORKFLOW_URL + ')',
112+
'',
113+
getConsoleLink(process.env.PR_NUMBER)
114+
].join('\n')
129115
});
130116
return { commentId: comment.data.id };
131117

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

-42
Original file line numberDiff line numberDiff line change
@@ -251,45 +251,3 @@ jobs:
251251
comment_id: process.env.COMMENT_ID,
252252
body: isSuccess ? successMessage : failureMessage
253253
});
254-
255-
show-help:
256-
if: |
257-
github.event_name == 'issue_comment' &&
258-
github.event.issue.pull_request &&
259-
github.event.comment.body == '/help'
260-
runs-on: ubuntu-latest
261-
262-
steps:
263-
- name: Show Available Commands
264-
uses: actions/github-script@v7
265-
with:
266-
script: |
267-
const helpMessage = [
268-
'## Available Commands',
269-
'',
270-
'### `/deploy-review-app`',
271-
'Deploys your PR branch to a review environment on Control Plane.',
272-
'- Creates a new review app if one doesn\'t exist',
273-
'- Updates the existing review app if it already exists',
274-
'- Provides a unique URL to preview your changes',
275-
'- Shows build and deployment progress in real-time',
276-
'',
277-
'### `/delete-review-app`',
278-
'Deletes the review app associated with this PR.',
279-
'- Removes all resources from Control Plane',
280-
'- Helpful for cleaning up when you\'re done testing',
281-
'- Can be re-deployed later using `/deploy-review-app`',
282-
'',
283-
'### `/help`',
284-
'Shows this help message explaining available commands.',
285-
'',
286-
'---',
287-
'_Note: These commands only work in pull request comments._'
288-
].join('\n');
289-
290-
await github.rest.issues.createComment({
291-
owner: context.repo.owner,
292-
repo: context.repo.repo,
293-
issue_number: context.payload.issue.number,
294-
body: helpMessage
295-
});

0 commit comments

Comments
 (0)