Skip to content

Commit 94852da

Browse files
authored
feat: handle PRs from comments (#4)
1 parent a6f172b commit 94852da

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

action.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ runs:
149149
commit_user_email: [email protected]
150150

151151
- name: Append success comment
152-
if: inputs.pr && steps.auto-commit.outputs.changes_detected == 'true'
152+
if: steps.comment-start.outputs.comment-id && steps.auto-commit.outputs.changes_detected == 'true'
153153
uses: peter-evans/create-or-update-comment@v4
154154
with:
155155
comment-id: ${{ steps.comment-start.outputs.comment-id }}
@@ -158,7 +158,7 @@ runs:
158158
✅ Poe command `${{ steps.resolve-command.outputs.command }}` completed successfully.
159159
160160
- name: Append no-op comment
161-
if: inputs.pr && steps.auto-commit.outputs.changes_detected != 'true'
161+
if: steps.comment-start.outputs.comment-id && steps.auto-commit.outputs.changes_detected != 'true'
162162
uses: peter-evans/create-or-update-comment@v4
163163
with:
164164
comment-id: ${{ steps.comment-start.outputs.comment-id }}
@@ -167,7 +167,7 @@ runs:
167167
🟦 Poe command `${{ steps.resolve-command.outputs.command }}` completed successfully. (No changes.)
168168
169169
- name: Append failure comment
170-
if: failure() && inputs.pr
170+
if: failure() && steps.comment-start.outputs.comment-id
171171
uses: peter-evans/create-or-update-comment@v4
172172
with:
173173
comment-id: ${{ steps.comment-start.outputs.comment-id }}
@@ -179,6 +179,7 @@ runs:
179179

180180
- name: Create Pull Request
181181
if: ${{ ! inputs.pr }}
182+
id: create-pr
182183
uses: peter-evans/create-pull-request@v7
183184
with:
184185
title: "Auto-generated PR: `poe ${{ steps.resolve-command.outputs.command }}`"
@@ -198,3 +199,13 @@ runs:
198199
commit-user-name: Octavia Squidington III
199200
commit-user-email: [email protected]
200201
token: ${{ inputs.github-token }}
202+
203+
- name: Append PR link to comment
204+
if: ${{ steps.comment-start.outputs.comment-id && ! inputs.pr && steps.create-pr.outputs.pull-request-url }}
205+
uses: peter-evans/create-or-update-comment@v4
206+
with:
207+
comment-id: ${{ steps.comment-start.outputs.comment-id }}
208+
body: >
209+
> 🚀 PR Created:
210+
>
211+
> - ${{ steps.create-pr.outputs.pull-request-url }}

0 commit comments

Comments
 (0)