poe-code 3.0.149 → 3.0.151
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2 -1
- package/dist/index.js.map +2 -2
- package/dist/prompts/github-pull-request-comment-created.md +25 -0
- package/dist/variables.yaml +3 -0
- package/dist/workflow-templates/github-pull-request-comment-created.caller.yml +25 -0
- package/dist/workflow-templates/github-pull-request-comment-created.ejected.yml +179 -0
- package/package.json +1 -1
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
label: "GitHub: Pull Request Comment Handler"
|
|
3
|
+
allow:
|
|
4
|
+
- OWNER
|
|
5
|
+
- MEMBER
|
|
6
|
+
- COLLABORATOR
|
|
7
|
+
prefix:
|
|
8
|
+
- "poe-code"
|
|
9
|
+
- "poe-code-agent"
|
|
10
|
+
- "@poe-code-agent"
|
|
11
|
+
---
|
|
12
|
+
Read {{url}} and leave a visible GitHub response to the comment from {{comment.author}}: {{comment.body}}
|
|
13
|
+
|
|
14
|
+
- This comment is on pull request #{{pr.number}}.
|
|
15
|
+
- Implement changes on the current PR branch, update the existing PR, and comment with the result.
|
|
16
|
+
- Do not open a new PR unless updating the existing PR is impossible.
|
|
17
|
+
- If blocked, comment with the blocker and next step.
|
|
18
|
+
|
|
19
|
+
{{skill_github_cli}}
|
|
20
|
+
|
|
21
|
+
{{pull_request_guidelines}}
|
|
22
|
+
|
|
23
|
+
{{response_style}}
|
|
24
|
+
|
|
25
|
+
{{verify_before_responding}}
|
package/dist/variables.yaml
CHANGED
|
@@ -12,6 +12,9 @@ verify_before_responding: |
|
|
|
12
12
|
|
|
13
13
|
skill_github_cli: |
|
|
14
14
|
Use the `gh` CLI for all GitHub operations (issues, PRs, reviews, checks).
|
|
15
|
+
When posting GitHub bodies, comments, or reviews that contain Markdown, code fences, backticks, `$`, or multiple lines, do not inline that text in a double-quoted shell argument.
|
|
16
|
+
Write the content with a quoted heredoc and pass it via `--body-file` so the shell cannot mangle it.
|
|
17
|
+
After posting or editing, verify the rendered result with `gh issue view` / `gh pr view`.
|
|
15
18
|
|
|
16
19
|
pull_request_guidelines: |
|
|
17
20
|
- One logical change per PR. Feel free to open multiple PRs.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
name: 'GitHub: Pull Request Comment Created'
|
|
2
|
+
on:
|
|
3
|
+
issue_comment:
|
|
4
|
+
types: [created]
|
|
5
|
+
|
|
6
|
+
# Keep these permissions in sync with the reusable workflow referenced below.
|
|
7
|
+
permissions:
|
|
8
|
+
contents: write
|
|
9
|
+
issues: write
|
|
10
|
+
pull-requests: write
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
run:
|
|
14
|
+
if: github.event.issue.pull_request != null
|
|
15
|
+
uses: __UPSTREAM_REPO__/.github/workflows/gh-github-pull-request-comment-created.yml@main
|
|
16
|
+
secrets: inherit
|
|
17
|
+
with:
|
|
18
|
+
ISSUE_NUMBER: ${{ github.event.issue.number }}
|
|
19
|
+
ISSUE_STATE: ${{ github.event.issue.state }}
|
|
20
|
+
COMMENT_ID: ${{ github.event.comment.id }}
|
|
21
|
+
COMMENT_BODY: ${{ github.event.comment.body }}
|
|
22
|
+
COMMENT_AUTHOR: ${{ github.event.comment.user.login }}
|
|
23
|
+
COMMENT_AUTHOR_ASSOCIATION: ${{ github.event.comment.author_association }}
|
|
24
|
+
COMMENT_USER_TYPE: ${{ github.event.comment.user.type }}
|
|
25
|
+
GITHUB_REPOSITORY: ${{ github.repository }}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
name: 'GitHub: Pull Request Comment Created'
|
|
2
|
+
on:
|
|
3
|
+
issue_comment:
|
|
4
|
+
types: [created]
|
|
5
|
+
|
|
6
|
+
concurrency:
|
|
7
|
+
group: ${{ github.workflow }}-${{ github.event.issue.number }}
|
|
8
|
+
cancel-in-progress: true
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
guard:
|
|
12
|
+
if: github.event.issue.pull_request != null && github.event.issue.state == 'open' && github.event.comment.user.type != 'Bot'
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
env:
|
|
15
|
+
OUTPUT_FORMAT: terminal
|
|
16
|
+
outputs:
|
|
17
|
+
should_run: ${{ steps.guard_result.outputs.should_run }}
|
|
18
|
+
permissions:
|
|
19
|
+
contents: read
|
|
20
|
+
steps:
|
|
21
|
+
- name: Preflight
|
|
22
|
+
env:
|
|
23
|
+
POE_CODE_AGENT_APP_ID: ${{ secrets.POE_CODE_AGENT_APP_ID }}
|
|
24
|
+
POE_CODE_AGENT_PRIVATE_KEY: ${{ secrets.POE_CODE_AGENT_PRIVATE_KEY }}
|
|
25
|
+
POE_API_KEY: ${{ secrets.POE_API_KEY }}
|
|
26
|
+
run: |
|
|
27
|
+
missing=()
|
|
28
|
+
[ -z "$POE_CODE_AGENT_APP_ID" ] && missing+=("POE_CODE_AGENT_APP_ID")
|
|
29
|
+
[ -z "$POE_CODE_AGENT_PRIVATE_KEY" ] && missing+=("POE_CODE_AGENT_PRIVATE_KEY")
|
|
30
|
+
[ -z "$POE_API_KEY" ] && missing+=("POE_API_KEY")
|
|
31
|
+
if [ ${#missing[@]} -gt 0 ]; then
|
|
32
|
+
for name in "${missing[@]}"; do
|
|
33
|
+
echo "::error::Missing required secret: $name — add it in Settings → Secrets and variables → Actions"
|
|
34
|
+
done
|
|
35
|
+
exit 1
|
|
36
|
+
fi
|
|
37
|
+
- uses: actions/create-github-app-token@v1
|
|
38
|
+
id: app-token
|
|
39
|
+
with:
|
|
40
|
+
app-id: ${{ secrets.POE_CODE_AGENT_APP_ID }}
|
|
41
|
+
private-key: ${{ secrets.POE_CODE_AGENT_PRIVATE_KEY }}
|
|
42
|
+
- uses: actions/checkout@v4
|
|
43
|
+
with:
|
|
44
|
+
token: ${{ steps.app-token.outputs.token }}
|
|
45
|
+
- uses: actions/setup-node@v4
|
|
46
|
+
with:
|
|
47
|
+
node-version: 20
|
|
48
|
+
- run: npm install -g poe-code@latest
|
|
49
|
+
- id: allow_check
|
|
50
|
+
continue-on-error: true
|
|
51
|
+
run: poe-code github-workflows require-user-allow github-pull-request-comment-created
|
|
52
|
+
env:
|
|
53
|
+
POE_CODE_STDERR_LOGS: "1"
|
|
54
|
+
COMMENT_AUTHOR_ASSOCIATION: ${{ github.event.comment.author_association }}
|
|
55
|
+
- id: prefix_check
|
|
56
|
+
continue-on-error: true
|
|
57
|
+
run: poe-code github-workflows require-comment-prefix github-pull-request-comment-created
|
|
58
|
+
env:
|
|
59
|
+
POE_CODE_STDERR_LOGS: "1"
|
|
60
|
+
COMMENT_BODY: ${{ github.event.comment.body }}
|
|
61
|
+
- id: guard_result
|
|
62
|
+
run: |
|
|
63
|
+
if [ "${{ steps.allow_check.outcome }}" = "success" ] && [ "${{ steps.prefix_check.outcome }}" = "success" ]; then
|
|
64
|
+
echo "should_run=true" >> "$GITHUB_OUTPUT"
|
|
65
|
+
else
|
|
66
|
+
echo "should_run=false" >> "$GITHUB_OUTPUT"
|
|
67
|
+
fi
|
|
68
|
+
|
|
69
|
+
run:
|
|
70
|
+
needs: guard
|
|
71
|
+
if: needs.guard.outputs.should_run == 'true'
|
|
72
|
+
runs-on: ubuntu-latest
|
|
73
|
+
env:
|
|
74
|
+
OUTPUT_FORMAT: terminal
|
|
75
|
+
permissions:
|
|
76
|
+
contents: write
|
|
77
|
+
issues: write
|
|
78
|
+
pull-requests: write
|
|
79
|
+
steps:
|
|
80
|
+
- name: Preflight
|
|
81
|
+
env:
|
|
82
|
+
POE_CODE_AGENT_APP_ID: ${{ secrets.POE_CODE_AGENT_APP_ID }}
|
|
83
|
+
POE_CODE_AGENT_PRIVATE_KEY: ${{ secrets.POE_CODE_AGENT_PRIVATE_KEY }}
|
|
84
|
+
POE_API_KEY: ${{ secrets.POE_API_KEY }}
|
|
85
|
+
run: |
|
|
86
|
+
missing=()
|
|
87
|
+
[ -z "$POE_CODE_AGENT_APP_ID" ] && missing+=("POE_CODE_AGENT_APP_ID")
|
|
88
|
+
[ -z "$POE_CODE_AGENT_PRIVATE_KEY" ] && missing+=("POE_CODE_AGENT_PRIVATE_KEY")
|
|
89
|
+
[ -z "$POE_API_KEY" ] && missing+=("POE_API_KEY")
|
|
90
|
+
if [ ${#missing[@]} -gt 0 ]; then
|
|
91
|
+
for name in "${missing[@]}"; do
|
|
92
|
+
echo "::error::Missing required secret: $name — add it in Settings → Secrets and variables → Actions"
|
|
93
|
+
done
|
|
94
|
+
exit 1
|
|
95
|
+
fi
|
|
96
|
+
- uses: actions/create-github-app-token@v1
|
|
97
|
+
id: app-token
|
|
98
|
+
with:
|
|
99
|
+
app-id: ${{ secrets.POE_CODE_AGENT_APP_ID }}
|
|
100
|
+
private-key: ${{ secrets.POE_CODE_AGENT_PRIVATE_KEY }}
|
|
101
|
+
- uses: actions/checkout@v4
|
|
102
|
+
with:
|
|
103
|
+
token: ${{ steps.app-token.outputs.token }}
|
|
104
|
+
- uses: actions/setup-node@v4
|
|
105
|
+
with:
|
|
106
|
+
node-version: 20
|
|
107
|
+
- run: npm install -g poe-code@latest
|
|
108
|
+
- id: pr_context
|
|
109
|
+
uses: actions/github-script@v7
|
|
110
|
+
with:
|
|
111
|
+
github-token: ${{ steps.app-token.outputs.token }}
|
|
112
|
+
script: |
|
|
113
|
+
const response = await github.rest.pulls.get({
|
|
114
|
+
owner: context.repo.owner,
|
|
115
|
+
repo: context.repo.repo,
|
|
116
|
+
pull_number: Number("${{ github.event.issue.number }}")
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
const headRepo = response.data.head.repo?.full_name ?? "";
|
|
120
|
+
const currentRepo = `${context.repo.owner}/${context.repo.repo}`;
|
|
121
|
+
const isSameRepo = headRepo === currentRepo;
|
|
122
|
+
|
|
123
|
+
core.setOutput("pr_number", String(response.data.number ?? ""));
|
|
124
|
+
core.setOutput("pr_title", response.data.title ?? "");
|
|
125
|
+
core.setOutput("pr_author", response.data.user?.login ?? "");
|
|
126
|
+
core.setOutput("head_ref", isSameRepo ? (response.data.head.ref ?? "") : "");
|
|
127
|
+
- id: add_in_progress_reaction
|
|
128
|
+
continue-on-error: true
|
|
129
|
+
uses: actions/github-script@v7
|
|
130
|
+
with:
|
|
131
|
+
github-token: ${{ steps.app-token.outputs.token }}
|
|
132
|
+
script: |
|
|
133
|
+
const response = await github.rest.reactions.createForIssueComment({
|
|
134
|
+
owner: context.repo.owner,
|
|
135
|
+
repo: context.repo.repo,
|
|
136
|
+
comment_id: Number("${{ github.event.comment.id }}"),
|
|
137
|
+
content: "eyes"
|
|
138
|
+
});
|
|
139
|
+
core.setOutput("reaction_id", String(response.data.id ?? ""));
|
|
140
|
+
- if: steps.pr_context.outputs.head_ref != ''
|
|
141
|
+
id: checkout_pr_branch
|
|
142
|
+
uses: actions/checkout@v4
|
|
143
|
+
with:
|
|
144
|
+
ref: ${{ steps.pr_context.outputs.head_ref }}
|
|
145
|
+
token: ${{ steps.app-token.outputs.token }}
|
|
146
|
+
- if: steps.pr_context.outputs.head_ref == ''
|
|
147
|
+
id: checkout_default_branch
|
|
148
|
+
uses: actions/checkout@v4
|
|
149
|
+
with:
|
|
150
|
+
token: ${{ steps.app-token.outputs.token }}
|
|
151
|
+
- run: poe-code github-workflows prepare github-pull-request-comment-created
|
|
152
|
+
env:
|
|
153
|
+
POE_CODE_STDERR_LOGS: "1"
|
|
154
|
+
POE_API_KEY: ${{ secrets.POE_API_KEY }}
|
|
155
|
+
- run: poe-code github-workflows github-pull-request-comment-created --yes
|
|
156
|
+
env:
|
|
157
|
+
POE_CODE_STDERR_LOGS: "1"
|
|
158
|
+
POE_API_KEY: ${{ secrets.POE_API_KEY }}
|
|
159
|
+
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
|
|
160
|
+
ISSUE_NUMBER: ${{ github.event.issue.number }}
|
|
161
|
+
PR_NUMBER: ${{ steps.pr_context.outputs.pr_number }}
|
|
162
|
+
PR_TITLE: ${{ steps.pr_context.outputs.pr_title }}
|
|
163
|
+
PR_AUTHOR: ${{ steps.pr_context.outputs.pr_author }}
|
|
164
|
+
COMMENT_BODY: ${{ github.event.comment.body }}
|
|
165
|
+
COMMENT_AUTHOR: ${{ github.event.comment.user.login }}
|
|
166
|
+
GITHUB_REPOSITORY: ${{ github.repository }}
|
|
167
|
+
- id: remove_in_progress_reaction
|
|
168
|
+
if: always() && steps.add_in_progress_reaction.outputs.reaction_id != ''
|
|
169
|
+
continue-on-error: true
|
|
170
|
+
uses: actions/github-script@v7
|
|
171
|
+
with:
|
|
172
|
+
github-token: ${{ steps.app-token.outputs.token }}
|
|
173
|
+
script: |
|
|
174
|
+
await github.rest.reactions.deleteForIssueComment({
|
|
175
|
+
owner: context.repo.owner,
|
|
176
|
+
repo: context.repo.repo,
|
|
177
|
+
comment_id: Number("${{ github.event.comment.id }}"),
|
|
178
|
+
reaction_id: Number("${{ steps.add_in_progress_reaction.outputs.reaction_id }}")
|
|
179
|
+
});
|