Loading...
Loading...
Use when triggering a post-merge deployment after a PR is merged (stage 1 of the post-merge pipeline).
npx skill4agent add fellowship-dev/dogfooded-skills post-mergedeployment-checker/post-merge PR_NUMBER org/repo/post-merge 42 fellowship-dev/pylotPR_NUMBER=$1 # PR number
REPO=$2 # org/repoPR=$1
REPO=$2
# Check if deployment-checker job already dispatched for this PR
EXISTING=$(ls ${PYLOT_DISPATCH_DIR:-$HOME/.local/share/pylot/missions}/pending/ \
${PYLOT_DISPATCH_DIR:-$HOME/.local/share/pylot/missions}/running/ 2>/dev/null \
| grep "deploy-check-${PR}-" || true)
if [ -n "$EXISTING" ]; then
echo "[post-merge] outcome=\"already dispatched — deploy-checker job exists\" status=success"
exit 0
fi# Fetch PR metadata
PR_DATA=$(gh pr view $PR --repo $REPO --json number,title,mergedAt,baseRefName,headRefName,files,url,mergeCommit)
PR_TITLE=$(echo "$PR_DATA" | python3 -c "import json,sys; d=json.load(sys.stdin); print(d['title'])")
PR_SHA=$(echo "$PR_DATA" | python3 -c "import json,sys; d=json.load(sys.stdin); print(d.get('mergeCommit',{}).get('oid','') or '')" 2>/dev/null || true)
CHANGED_FILES=$(echo "$PR_DATA" | python3 -c "import json,sys; d=json.load(sys.stdin); print('\n'.join(f['path'] for f in d['files']))")
BASE_BRANCH=$(echo "$PR_DATA" | python3 -c "import json,sys; d=json.load(sys.stdin); print(d['baseRefName'])")
echo "PR: $PR — $PR_TITLE"
echo "SHA: $PR_SHA"
echo "Base: $BASE_BRANCH"
echo "Files changed:"
echo "$CHANGED_FILES"deploy:# Example in crew/infra/CLAUDE.md or team CLAUDE.md:
deploy:
method: auto-pull # auto-pull | github-actions | manual
health_url: "http://localhost:1337/_health"
timeout_minutes: 5
checker_script: "scripts/deployment-checker-pylot.sh"
expected_sha_field: "sha" # JSON field in health response containing deployed sha| Method | Action |
|---|---|
| Deploy is automatic. Skip Step 3 and Step 4 (auto-deploy.sh handles deploy-check). |
| Deploy triggered by merge. Wait ~2 min, then Step 4. |
| CTO runs deploy command now (Step 3), then Step 4. |
method: manual# Example: manual deploy for a Fly.io app
cd /path/to/repo && fly deploy --remote-only
# Example: manual ECR push
aws ecr get-login-password | docker login --username AWS --password-stdin $ECR_URI
docker build -t $IMAGE . && docker push $IMAGEmethod: auto-pullauto-deploy.shgithub-actionsmanualif [ "$DEPLOY_METHOD" != "auto-pull" ]; then
PYLOT_DIR="${PYLOT_DIR:-$HOME/projects/fellowship-dev/pylot}"
curl -sS -X POST \
-H "Authorization: Bearer $(grep '^PYLOT_DISPATCH_TOKEN=' $HOME/projects/fellowship-dev/claude-buddy/.env | cut -d= -f2)" \
-H "Content-Type: application/json" \
-d "$(python3 -c "import json; print(json.dumps({'agent':'${TEAM}.intern','task':'Check deployment for $REPO#$PR — $PR_TITLE','repo':'$REPO','context':'SHA: $PR_SHA. Health URL: $HEALTH_URL. Timeout: ${TIMEOUT_MINUTES:-5} minutes. Checker script: ${CHECKER_SCRIPT}. Run /deployment-checker $PR $REPO.'}))")" \
"http://127.0.0.1:3000/dispatch"
else
echo "[post-merge] Skipping deploy-check dispatch — auto-pull deploys are checked by auto-deploy.sh"
figh pr comment $PR --repo $REPO --body "$(cat <<'EOF'
**Post-merge pipeline started** 🚀
| Field | Value |
|-------|-------|
| Deploy method | \`$DEPLOY_METHOD\` |
| Health endpoint | \`$HEALTH_URL\` |
| Timeout | ${TIMEOUT_MINUTES:-5} min |
| Expected SHA | \`${PR_SHA:-unknown}\` |
Deployment checker dispatched. Will apply \`deployed\` or \`deploy-failed\` label when complete.
EOF
)"PYLOT_DIR="${PYLOT_DIR:-$HOME/projects/fellowship-dev/pylot}"
REPORT="$PYLOT_DIR/reports/$(date +%Y-%m-%d)-post-merge-$(echo $REPO | tr '/' '-')-pr${PR}.md"
cat > "$REPORT" <<EOF
# Post-Merge: $REPO PR #$PR — $PR_TITLE
**Date**: $(date +%Y-%m-%d)
**PR**: [$REPO#$PR]($PR_URL)
**SHA**: $PR_SHA
**Deploy method**: $DEPLOY_METHOD
**Deploy-checker job**: dispatched
## Changed Files
$CHANGED_FILES
## Outcome
Deploy-checker dispatched. Awaiting health confirmation.
EOFdeploy:deploy:
method: auto-pull
health_url: "http://localhost:1337/_health"
timeout_minutes: 5
checker_script: "scripts/deployment-checker-pylot.sh"
expected_sha_field: "sha"deploy:
method: github-actions
health_url: "https://api.lexgo.cl/_health"
timeout_minutes: 30
checker_script: "scripts/deployment-checker-lexgo.sh"deploy:
method: auto-pull
health_url: "https://api.booster-pack.dev/health"
timeout_minutes: 10