diff --git a/scripts/prompt.md b/scripts/prompt.md index 2e96e0a..d1d8582 100644 --- a/scripts/prompt.md +++ b/scripts/prompt.md @@ -13,8 +13,14 @@ Prefer minimal, correct changes. Run relevant checks or tests if practical. Commit your changes locally. Do not expose secrets. Finish by reporting what changed and what tests ran. -The triggering comment body is below. - ---- +# Comment body +``` ${COMMENT_BODY} +``` + +# Full issue comment history + +``` +${ISSUE_COMMENTS} +``` \ No newline at end of file diff --git a/scripts/run-codex.sh b/scripts/run-codex.sh index 804894a..b44e0f5 100644 --- a/scripts/run-codex.sh +++ b/scripts/run-codex.sh @@ -4,6 +4,13 @@ set -euo pipefail git config --global user.name bot git config --global user.email noreply@capsulizers.com +export ISSUE_COMMENTS="$( + curl --fail-with-body --silent --show-error \ + -H "Authorization: token ${GITEA_TOKEN}" \ + "${GITEA_API_URL}/repos/${GITEA_REPOSITORY}/issues/${ISSUE_INDEX}/comments?limit=100" \ + | jq -r '.[] | "## " + .user.login + " at " + .created_at + "\n\n" + .body + "\n"' +)" + FINAL_PROMPT="$(envsubst < "${ACTION_PATH}/scripts/prompt.md")" OUTPUT_FILE="$(mktemp)"