Skip to content

fix: update WalletKit Android Maven artifact name #3189

fix: update WalletKit Android Maven artifact name

fix: update WalletKit Android Maven artifact name #3189

Workflow file for this run

name: 🤖 AI review
on:
pull_request:
types: [opened, ready_for_review]
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
pull_request_target:
types: [opened]
permissions:
contents: read
pull-requests: write
issues: write
jobs:
fork-pr-note:
if: github.event_name == 'pull_request_target' && github.event.action == 'opened' && github.event.pull_request.head.repo.full_name != github.repository
runs-on: ubuntu-latest
steps:
- name: Comment external PR use /review
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
PR_NUMBER="${{ github.event.pull_request.number }}"
API="https://api.github.com/repos/${{ github.repository }}/issues/${PR_NUMBER}/comments"
BODY=$(cat <<'TXT'
Skipping AI review because this PR is from a fork. A maintainer can start the review by commenting /review in this PR.
TXT
)
jq -n --arg body "$BODY" '{body:$body}' > payload.json
curl -sS -X POST "$API" \
-H "Authorization: Bearer ${GITHUB_TOKEN}" \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-H "Content-Type: application/json" \
-d @payload.json >/dev/null
pr-review:
concurrency:
group: pitaya-ai-review-${{ github.event.pull_request.number || github.event.issue.number || github.run_id }}
cancel-in-progress: true
# Run on:
# - PR events when ready_for_review or opened as non‑draft
# - Issue comments only when it's a PR thread, command is /review, and commenter is trusted
if: |
(
github.event_name == 'pull_request' &&
((github.event.action == 'ready_for_review') || (github.event.action == 'opened' && github.event.pull_request.draft == false)) &&
github.event.pull_request.head.repo.full_name == github.repository
) ||
(
github.event_name == 'issue_comment' &&
github.event.issue.pull_request != null &&
(github.event.comment.body == '/review' || startsWith(github.event.comment.body, '/review ')) &&
(
github.event.comment.author_association == 'OWNER' ||
github.event.comment.author_association == 'MEMBER' ||
github.event.comment.author_association == 'COLLABORATOR'
)
) ||
(
github.event_name == 'pull_request_review_comment' &&
(github.event.comment.body == '/review' || startsWith(github.event.comment.body, '/review ')) &&
(
github.event.comment.author_association == 'OWNER' ||
github.event.comment.author_association == 'MEMBER' ||
github.event.comment.author_association == 'COLLABORATOR'
)
)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: PR context
env:
GH_TOKEN: ${{ github.token }}
PR_FROM_PR: ${{ github.event.pull_request.number }}
PR_FROM_ISSUE: ${{ github.event.issue.number }}
run: |
set -euo pipefail
PR_NUMBER="${PR_FROM_PR:-}"
if [ -z "${PR_NUMBER:-}" ] || [ "$PR_NUMBER" = "null" ]; then
PR_NUMBER="${PR_FROM_ISSUE:-}"
fi
if [ -z "${PR_NUMBER:-}" ] || [ "$PR_NUMBER" = "null" ]; then
echo "PR number not provided." >&2
exit 1
fi
echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV
gh api repos/${{ github.repository }}/pulls/${PR_NUMBER} > pr.json
echo "BASE_REF=$(jq -r '.base.ref' pr.json)" >> $GITHUB_ENV
echo "HEAD_REF=$(jq -r '.head.ref' pr.json)" >> $GITHUB_ENV
BASE_REPO="${{ github.repository }}"
HEAD_REPO="$(jq -r '.head.repo.full_name // ""' pr.json)"
if [ -n "$HEAD_REPO" ] && [ "$HEAD_REPO" != "$BASE_REPO" ]; then
echo "IS_FORK=true" >> $GITHUB_ENV
else
echo "IS_FORK=false" >> $GITHUB_ENV
fi
- name: React 👀 on PR
env:
GH_TOKEN: ${{ github.token }}
REPO: ${{ github.repository }}
run: |
set -euo pipefail
rid=""
if ! rid=$(gh api \
-X POST \
-H "X-GitHub-Api-Version: 2022-11-28" \
"/repos/${REPO}/issues/${PR_NUMBER}/reactions" \
-f content=eyes \
--jq '.id // empty' 2>/dev/null); then
echo "::warning::Failed to add 👀 reaction to PR ${PR_NUMBER}." >&2
fi
if [ -n "${rid:-}" ]; then
echo "PR_REACTION_EYES_ID=$rid" >> "$GITHUB_ENV"
fi
- name: React 👀 on comment
if: github.event_name == 'issue_comment'
env:
GH_TOKEN: ${{ github.token }}
REPO: ${{ github.repository }}
COMMENT_ID: ${{ github.event.comment.id }}
run: |
set -euo pipefail
rid=""
if ! rid=$(gh api \
-X POST \
-H "X-GitHub-Api-Version: 2022-11-28" \
"/repos/${REPO}/issues/comments/${COMMENT_ID}/reactions" \
-f content=eyes \
--jq '.id // empty' 2>/dev/null); then
echo "::warning::Failed to add 👀 reaction to comment ${COMMENT_ID}." >&2
fi
if [ -n "${rid:-}" ]; then
echo "ISSUE_COMMENT_REACTION_EYES_ID=$rid" >> "$GITHUB_ENV"
fi
- name: React 👀 on inline comment
if: github.event_name == 'pull_request_review_comment'
env:
GH_TOKEN: ${{ github.token }}
REPO: ${{ github.repository }}
COMMENT_ID: ${{ github.event.comment.id }}
run: |
set -euo pipefail
rid=""
if ! rid=$(gh api \
-X POST \
-H "X-GitHub-Api-Version: 2022-11-28" \
"/repos/${REPO}/pulls/comments/${COMMENT_ID}/reactions" \
-f content=eyes \
--jq '.id // empty' 2>/dev/null); then
echo "::warning::Failed to add 👀 reaction to review comment ${COMMENT_ID}." >&2
fi
if [ -n "${rid:-}" ]; then
echo "REVIEW_COMMENT_REACTION_EYES_ID=$rid" >> "$GITHUB_ENV"
fi
- name: Checkout PR head
run: |
set -euo pipefail
git fetch origin "pull/${PR_NUMBER}/head:pr_head"
git checkout -B pr_head pr_head
- name: Fetch branches
run: git fetch origin "+refs/heads/*:refs/remotes/origin/*"
- name: Ensure base branch
run: |
BASE_REF="${BASE_REF:-main}"
if ! git show-ref --verify --quiet "refs/heads/${BASE_REF}"; then
git branch --track "${BASE_REF}" "origin/${BASE_REF}" || true
fi
- name: Use repo scripts
if: env.IS_FORK != 'true'
run: |
set -euo pipefail
echo "USING_TRUSTED_CI_SCRIPTS=$GITHUB_WORKSPACE/.github/scripts" >> $GITHUB_ENV
- name: Use base scripts for forks
if: env.IS_FORK == 'true'
run: |
set -euo pipefail
mkdir -p "$RUNNER_TEMP/ai-ci"
git show "$BASE_REF":.github/scripts/build_review_instructions.py > "$RUNNER_TEMP/ai-ci/build_review_instructions.py"
git show "$BASE_REF":.github/scripts/build_review_payload.py > "$RUNNER_TEMP/ai-ci/build_review_payload.py"
echo "USING_TRUSTED_CI_SCRIPTS=$RUNNER_TEMP/ai-ci" >> $GITHUB_ENV
- name: Detect docs changes
run: |
set -euo pipefail
# Compare PR head against BASE_REF and look for docs changes
CHANGED=$(git diff --name-only "$BASE_REF"...pr_head | grep -E '(\.(md|mdx)$|^docs\.json$)' || true)
if [ -z "$CHANGED" ]; then
echo "DOCS_CHANGED=false" >> $GITHUB_ENV
echo "No docs (.md, .mdx, docs.json) changes detected; skipping AI review." >&2
else
echo "DOCS_CHANGED=true" >> $GITHUB_ENV
echo "$CHANGED" | sed 's/^/- /' >&2
fi
- name: Comment no docs changes
if: env.DOCS_CHANGED != 'true'
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
API="https://api.github.com/repos/${{ github.repository }}/issues/${PR_NUMBER}/comments"
BODY=$(cat <<'TXT'
Skipping AI review because no docs changes in md, mdx, or docs.json
TXT
)
jq -n --arg body "$BODY" '{body:$body}' > payload.json
curl -sS -X POST "$API" \
-H "Authorization: Bearer ${GITHUB_TOKEN}" \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-H "Content-Type: application/json" \
-d @payload.json >/dev/null
- name: Check secrets
if: env.DOCS_CHANGED == 'true' && (env.IS_FORK != 'true' || github.event_name != 'pull_request')
env:
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
run: |
if [ -z "${OPENROUTER_API_KEY:-}" ]; then
echo "OPENROUTER_API_KEY is not set. Add it to repository secrets." >&2
exit 2
fi
- name: Setup Python
if: env.DOCS_CHANGED == 'true' && (env.IS_FORK != 'true' || github.event_name != 'pull_request')
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Setup uv
if: env.DOCS_CHANGED == 'true' && (env.IS_FORK != 'true' || github.event_name != 'pull_request')
uses: astral-sh/setup-uv@v3
- name: Checkout Pitaya
if: env.DOCS_CHANGED == 'true' && (env.IS_FORK != 'true' || github.event_name != 'pull_request')
uses: actions/checkout@v4
with:
repository: tact-lang/pitaya
path: pitaya-src
- name: Install Pitaya deps
if: env.DOCS_CHANGED == 'true' && (env.IS_FORK != 'true' || github.event_name != 'pull_request')
working-directory: pitaya-src
run: uv sync
- name: Build agent image
if: env.DOCS_CHANGED == 'true' && (env.IS_FORK != 'true' || github.event_name != 'pull_request')
run: docker build -t pitaya-agents:latest pitaya-src
- name: Run Pitaya review
if: env.DOCS_CHANGED == 'true' && (env.IS_FORK != 'true' || github.event_name != 'pull_request')
working-directory: pitaya-src
env:
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
OPENROUTER_BASE_URL: https://openrouter.ai/api/v1
run: |
REVIEW_INSTRUCTIONS=$(python3 "$USING_TRUSTED_CI_SCRIPTS/build_review_instructions.py")
uv run pitaya "Review this pull request" \
--repo "$GITHUB_WORKSPACE" \
--base-branch pr_head \
--strategy pr-review \
-S reviewers=2 \
-S ci_fail_policy=never \
-S base_branch="$BASE_REF" \
-S include_branches="pr_head,$BASE_REF" \
-S review_instructions="$REVIEW_INSTRUCTIONS" \
--plugin codex \
--model "openai/gpt-5.1" \
--no-tui \
--verbose
- name: Post review
if: env.DOCS_CHANGED == 'true' && (env.IS_FORK != 'true' || github.event_name != 'pull_request')
working-directory: pitaya-src
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
RUN_DIR="$(ls -td .pitaya/results/run_* 2>/dev/null | head -n1)"
if [ -z "${RUN_DIR:-}" ] || [ ! -d "$RUN_DIR" ]; then
echo "No results directory found" >&2
exit 1
fi
# Sidecar must exist (selection may be empty when approving clean PRs)
SIDECAR="$RUN_DIR/review/index.json"
if [ ! -f "$SIDECAR" ]; then
echo "Sidecar not found: $SIDECAR" >&2
exit 1
fi
COMMIT_ID="$(jq -r '.commit_id // empty' "$SIDECAR")"
if [ -z "$COMMIT_ID" ]; then
echo "commit_id missing in sidecar; aborting." >&2
exit 1
fi
# Build review payload (summary + inline comments)
INLINE_SEVERITIES="${INLINE_SEVERITIES:-HIGH}" # comma-separated; default HIGH only
MAX_COMMENTS="${MAX_COMMENTS:-40}"
python3 "$USING_TRUSTED_CI_SCRIPTS/build_review_payload.py" \
--run-dir "$RUN_DIR" \
--repo "${{ github.repository }}" \
--sha "$COMMIT_ID" \
--severities "${INLINE_SEVERITIES}" \
--max-comments "${MAX_COMMENTS}" > review_payload.json
API="https://api.github.com/repos/${{ github.repository }}/pulls/${PR_NUMBER}/reviews"
COMMENTS=$(jq -r '.comments | length' review_payload.json)
BODY_TEXT=$(jq -r '.body // empty' review_payload.json)
if [ "${BODY_TEXT// }" = "" ]; then
BODY_TEXT="No documentation issues detected."
jq --arg body "$BODY_TEXT" '.body = $body' review_payload.json > review_payload.tmp && mv review_payload.tmp review_payload.json
fi
echo "Submitting PR review (comments: $COMMENTS)..."
HTTP_CODE=$(curl -sS -o response.json -w "%{http_code}" -X POST "$API" \
-H "Authorization: Bearer ${GITHUB_TOKEN}" \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-H "Content-Type: application/json" \
-d @review_payload.json || true)
echo "GitHub API HTTP: ${HTTP_CODE:-<none>}"
if ! [[ "$HTTP_CODE" =~ ^[0-9]{3}$ ]] || [ "$HTTP_CODE" -lt 200 ] || [ "$HTTP_CODE" -ge 300 ]; then
echo "Response body:"; cat response.json || true; echo
# Attempt to submit inline comments individually so good ones still land.
COMMENT_API_INLINE="https://api.github.com/repos/${{ github.repository }}/pulls/${PR_NUMBER}/comments"
BODY_TEXT=$(jq -r '.body // ""' review_payload.json)
COMMIT_FOR_COMMENTS=$(jq -r '.commit_id // ""' review_payload.json)
GOOD=0; BAD=0
BAD_SUMMARY_FILE=$(mktemp)
: > "$BAD_SUMMARY_FILE"
while IFS= read -r c; do
TMP=$(mktemp)
echo "$c" | jq --arg commit "$COMMIT_FOR_COMMENTS" '{
body: .body,
commit_id: ($commit // .commit_id // ""),
path: .path
} + (if has("line") then {line:.line, side:(.side//"RIGHT")} else {} end)
+ (if has("start_line") then {start_line:.start_line, start_side:(.start_side//"RIGHT")} else {} end)' > "$TMP"
HTTP_COMMENT=$(curl -sS -o response_comment.json -w "%{http_code}" -X POST "$COMMENT_API_INLINE" \
-H "Authorization: Bearer ${GITHUB_TOKEN}" \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-H "Content-Type: application/json" \
-d @"$TMP" || true)
if [[ "$HTTP_COMMENT" =~ ^2[0-9][0-9]$ ]]; then
GOOD=$((GOOD+1))
else
BAD=$((BAD+1))
PATH_LINE=$(echo "$c" | jq -r '"\(.path):L\(.start_line // .line // "?")-L\(.line // .start_line // "?")"')
BODY_SNIP=$(echo "$c" | jq -r '.body')
BODY_SNIP_FIRST6=$(printf "%s" "$BODY_SNIP" | head -n 6)
BODY_SNIP_LINECOUNT=$(printf "%s\n" "$BODY_SNIP" | wc -l)
{
echo "- ${PATH_LINE}"
printf "%s" "$BODY_SNIP_FIRST6" | sed 's/^/ /'
if [ "$BODY_SNIP_LINECOUNT" -gt 6 ]; then
echo " …(truncated)"
fi
echo
} >> "$BAD_SUMMARY_FILE"
fi
rm -f "$TMP" response_comment.json
done < <(jq -c '.comments[]' review_payload.json)
# Build fallback timeline comment containing intro + failed inline text (if any)
COMMENT_API="https://api.github.com/repos/${{ github.repository }}/issues/${PR_NUMBER}/comments"
FALLBACK_FILE=$(mktemp)
{
echo "$BODY_TEXT"
echo
echo "---"
echo "Per-comment submission: ${GOOD} posted, ${BAD} failed."
if [ "$BAD" -gt 0 ]; then
echo
echo "Unposted inline comments (raw text):"
cat "$BAD_SUMMARY_FILE"
fi
} > "$FALLBACK_FILE"
jq -n --arg body "$(cat "$FALLBACK_FILE")" '{body:$body}' > payload.json
HTTP_CODE2=$(curl -sS -o response2.json -w "%{http_code}" -X POST "$COMMENT_API" \
-H "Authorization: Bearer ${GITHUB_TOKEN}" \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-H "Content-Type: application/json" \
-d @payload.json || true)
echo "Fallback GitHub API HTTP: $HTTP_CODE2"; cat response2.json || true; echo
if ! [[ "$HTTP_CODE2" =~ ^[0-9]{3}$ ]] || [ "$HTTP_CODE2" -lt 200 ] || [ "$HTTP_CODE2" -ge 300 ]; then
echo "::error::Failed to submit PR review, per-comment comments, and fallback comment." >&2
exit 1
fi
rm -f "$BAD_SUMMARY_FILE" "$FALLBACK_FILE"
fi
- name: Summary
if: env.DOCS_CHANGED == 'true' && (env.IS_FORK != 'true' || github.event_name != 'pull_request')
working-directory: pitaya-src
run: |
set -euo pipefail
RUN_DIR="$(ls -td .pitaya/results/run_* 2>/dev/null | head -n1)"
if [ -z "${RUN_DIR:-}" ]; then
exit 0
fi
SUMMARY_FILE="$RUN_DIR/summary.md"
INTRO_FILE="$RUN_DIR/review/index.json"
{
echo "### Pitaya Review"
if [ -f "$INTRO_FILE" ]; then
INTRO=$(jq -r '.intro // empty' "$INTRO_FILE")
SEL=$(jq -r '.selected_details | length' "$INTRO_FILE")
EVENT=$(jq -r '.event // empty' "$INTRO_FILE"); if [ -z "$EVENT" ]; then EVENT=COMMENT; fi
COMMIT=$(jq -r '.commit_id // empty' "$INTRO_FILE")
echo ""
if [ -n "$INTRO" ]; then
echo "$INTRO"
echo ""
fi
echo "- Outcome $EVENT"
echo "- Inline suggestions $SEL"
if [ -n "$COMMIT" ]; then
echo "- Reviewed commit \`$COMMIT\`"
fi
fi
if [ -f "$SUMMARY_FILE" ]; then
echo ""
echo "<details><summary>Run stats</summary>"
echo ""
tail -n +2 "$SUMMARY_FILE"
echo "</details>"
fi
} >> "$GITHUB_STEP_SUMMARY"
- name: Archive logs
if: env.DOCS_CHANGED == 'true' && (env.IS_FORK != 'true' || github.event_name != 'pull_request')
id: pitaya_artifacts
working-directory: pitaya-src
run: |
set -euo pipefail
if compgen -G ".pitaya/logs/run_*" >/dev/null || compgen -G ".pitaya/results/run_*" >/dev/null; then
tar -czf pitaya-artifacts.tar.gz .pitaya/logs/run_* .pitaya/results/run_* 2>/dev/null || true
echo "has_artifacts=true" >> "$GITHUB_OUTPUT"
else
echo "No Pitaya logs or results to archive." >&2
echo "has_artifacts=false" >> "$GITHUB_OUTPUT"
fi
- name: Upload artifacts
if: env.DOCS_CHANGED == 'true' && (env.IS_FORK != 'true' || github.event_name != 'pull_request') && steps.pitaya_artifacts.outputs.has_artifacts == 'true'
uses: actions/upload-artifact@v4
with:
name: pitaya-logs-${{ github.run_id }}
path: pitaya-src/pitaya-artifacts.tar.gz
if-no-files-found: ignore
retention-days: 7
- name: Cleanup 👀
if: always()
env:
GH_TOKEN: ${{ github.token }}
REPO: ${{ github.repository }}
PR_REACTION_EYES_ID: ${{ env.PR_REACTION_EYES_ID }}
ISSUE_COMMENT_REACTION_EYES_ID: ${{ env.ISSUE_COMMENT_REACTION_EYES_ID }}
REVIEW_COMMENT_REACTION_EYES_ID: ${{ env.REVIEW_COMMENT_REACTION_EYES_ID }}
COMMENT_ID: ${{ github.event.comment.id }}
run: |
set -euo pipefail
# Remove from PR
if [ -n "${PR_REACTION_EYES_ID:-}" ]; then
gh api -X DELETE \
-H "X-GitHub-Api-Version: 2022-11-28" \
"/repos/${REPO}/issues/${PR_NUMBER}/reactions/${PR_REACTION_EYES_ID}" \
>/dev/null 2>&1 || echo "::warning::Failed to remove 👀 from PR ${PR_NUMBER}." >&2
fi
# Remove from issue comment
if [ -n "${ISSUE_COMMENT_REACTION_EYES_ID:-}" ] && [ -n "${COMMENT_ID:-}" ]; then
gh api -X DELETE \
-H "X-GitHub-Api-Version: 2022-11-28" \
"/repos/${REPO}/issues/comments/${COMMENT_ID}/reactions/${ISSUE_COMMENT_REACTION_EYES_ID}" \
>/dev/null 2>&1 || echo "::warning::Failed to remove 👀 from issue comment ${COMMENT_ID}." >&2
fi
# Remove from review comment
if [ -n "${REVIEW_COMMENT_REACTION_EYES_ID:-}" ] && [ -n "${COMMENT_ID:-}" ]; then
gh api -X DELETE \
-H "X-GitHub-Api-Version: 2022-11-28" \
"/repos/${REPO}/pulls/comments/${COMMENT_ID}/reactions/${REVIEW_COMMENT_REACTION_EYES_ID}" \
>/dev/null 2>&1 || echo "::warning::Failed to remove 👀 from review comment ${COMMENT_ID}." >&2
fi