Skip to content

Commit 7e409cb

Browse files
committed
delete-on-pr-close
1 parent 63fa0e8 commit 7e409cb

File tree

2 files changed

+35
-7
lines changed

2 files changed

+35
-7
lines changed
Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,30 @@
1-
name: Add helper Comment on PR creation
1+
name: Add Comment on PR Creation
22

33
on:
44
pull_request:
55
types: [opened]
66

77
jobs:
8-
comment-on-pr:
8+
add-comment:
99
runs-on: ubuntu-latest
10+
permissions:
11+
pull-requests: write
1012
steps:
11-
- name: Add GitHub Comment for review app instructions
13+
- name: Add comment
1214
uses: actions/github-script@v7
1315
with:
1416
script: |
15-
github.rest.issues.createComment({
16-
issue_number: context.issue.number,
17+
await github.rest.issues.createComment({
1718
owner: context.repo.owner,
1819
repo: context.repo.repo,
19-
body: "Hi 👋 To deploy a review app, please comment `/deploy-review-app`"
20-
})
20+
issue_number: context.payload.pull_request.number,
21+
body: [
22+
"Hi 👋 Here are the commands available for this PR:",
23+
"",
24+
"- `/deploy`: Deploy your changes to a review environment",
25+
"- `/delete-review-app`: Clean up the review environment when you're done",
26+
"- `/help`: Show detailed information about all commands",
27+
"",
28+
"Use `/help` to see full documentation, including configuration options."
29+
].join("\n")
30+
});

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,25 @@ env:
2020
PR_NUMBER: ${{ github.event.pull_request.number || github.event.issue.number }}
2121

2222
jobs:
23+
debug-trigger:
24+
if: always()
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Debug Trigger Conditions
28+
env:
29+
EVENT_NAME: ${{ github.event_name }}
30+
IS_PR: ${{ toJSON(github.event.issue.pull_request) }}
31+
COMMENT: ${{ github.event.comment.body }}
32+
run: |
33+
echo "Debug information for deploy command:"
34+
echo "Event name: $EVENT_NAME"
35+
echo "Is PR (raw): $IS_PR"
36+
echo "Comment body: $COMMENT"
37+
echo "Raw event payload:"
38+
echo '${{ toJSON(github.event) }}'
39+
2340
Process-Deployment-Command:
41+
needs: debug-trigger
2442
if: |
2543
(github.event_name == 'pull_request') ||
2644
(github.event_name == 'issue_comment' &&

0 commit comments

Comments
 (0)