Split author and reviewer tokens
This commit is contained in:
+7
-23
@@ -1,20 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
git config --global user.name bot
|
||||
git config --global user.email noreply@capsulizers.com
|
||||
. "${ACTION_PATH}/scripts/lib.sh"
|
||||
|
||||
COMMENT_FILE="$(mktemp)"
|
||||
|
||||
post_comment() {
|
||||
COMMENT_JSON="$(jq -n --rawfile body "${COMMENT_FILE}" '{body: $body}')"
|
||||
curl --fail-with-body --silent --show-error \
|
||||
-X POST \
|
||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
--data "${COMMENT_JSON}" \
|
||||
"${GITEA_API_URL}/repos/${GITEA_REPOSITORY}/issues/${ISSUE_INDEX}/comments"
|
||||
}
|
||||
configure_git_author
|
||||
|
||||
if ! codex login status > /dev/null 2>&1; then
|
||||
codex login --device-auth 2>&1 | ansifilter > "${COMMENT_FILE}" &
|
||||
@@ -26,18 +15,13 @@ if ! codex login status > /dev/null 2>&1; then
|
||||
post_comment
|
||||
fi
|
||||
|
||||
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="$(render_prompt)"
|
||||
|
||||
FINAL_PROMPT="$(envsubst < "${ACTION_PATH}/scripts/prompt.md")"
|
||||
|
||||
codex exec --model gpt-5.5 \
|
||||
# The reviewer token is unset so the agent cannot approve as the bot.
|
||||
env -u REVIEWER_TOKEN \
|
||||
codex exec --model gpt-5.5 \
|
||||
--dangerously-bypass-approvals-and-sandbox \
|
||||
--output-last-message "${COMMENT_FILE}" \
|
||||
"${FINAL_PROMPT}"
|
||||
|
||||
post_comment
|
||||
post_result
|
||||
|
||||
Reference in New Issue
Block a user