diff --git a/.github/workflows/update_fsc_evm_version.yml b/.github/workflows/update_fsc_evm_version.yml index ef908daa..762e0743 100644 --- a/.github/workflows/update_fsc_evm_version.yml +++ b/.github/workflows/update_fsc_evm_version.yml @@ -157,21 +157,8 @@ jobs: continue fi - # Create PR - PR_BODY="## 🔄 Automated fsc-evm Update - -This PR updates the fsc-evm package version from \`${CURRENT_VERSION}\` to \`${VERSION}\`. - -### Changes -\`\`\`diff -packages: - - git: https://github.com/FlipsideCrypto/fsc-evm.git -- revision: ${CURRENT_VERSION} -+ revision: ${VERSION} -\`\`\` - ---- -*This PR was auto-generated by the fsc-evm version update workflow.*" + # Create PR body - use printf to avoid backtick issues + PR_BODY="## 🔄 Automated fsc-evm Update" # Create PR and capture output PR_OUTPUT=$(gh pr create \ @@ -229,28 +216,1223 @@ packages: done | sort # Set job summary - { - echo "# fsc-evm Version Update Summary" + cat >> $GITHUB_STEP_SUMMARY << EOF + # fsc-evm Version Update Summary + + **Version:** ${VERSION} + **Total Repositories:** ${#REPOS[@]} + + | Status | Count | + |--------|-------| + | ✅ Successful | ${SUCCESS_COUNT} | + | ⏭️ Skipped | ${SKIP_COUNT} | + | ❌ Failed | ${FAIL_COUNT} | + + ## Pull Requests Created + + EOF + + # Add PR links + for repo in "${!RESULTS[@]}"; do + status="${RESULTS[$repo]}" + if [[ $status == SUCCESS* ]]; then + url="${status#SUCCESS: }" + echo "- [${repo}](${url})" >> $GITHUB_STEP_SUMMARY + fi + done | sort >> $GITHUB_STEP_SUMMARY + + # Exit with error if any failed + if [ $FAIL_COUNT -gt 0 ]; then echo "" - echo "**Version:** ${VERSION}" - echo "**Total Repositories:** ${#REPOS[@]}" + echo "❌ Some repositories failed to update" + exit 1 + else echo "" - echo "| Status | Count |" - echo "|--------|-------|" - echo "| ✅ Successful | ${SUCCESS_COUNT} |" - echo "| ⏭️ Skipped | ${SKIP_COUNT} |" - echo "| ❌ Failed | ${FAIL_COUNT} |" + echo "✨ All repositories processed successfully!" + fi\n' + + # Create PR and capture output + PR_OUTPUT=$(gh pr create \ + --repo "${FULL_REPO}" \ + --title "chore: update fsc-evm to ${VERSION}" \ + --body "${PR_BODY}" \ + --base main \ + --head "${BRANCH}" 2>&1) || true + + if echo "$PR_OUTPUT" | grep -q "github.com"; then + PR_URL=$(echo "$PR_OUTPUT" | grep -o 'https://github.com/[^ ]*' | head -1) + echo " ✅ PR created: ${PR_URL}" + RESULTS["${repo}"]="SUCCESS: ${PR_URL}" + ((SUCCESS_COUNT++)) + elif echo "$PR_OUTPUT" | grep -q "already exists"; then + # Get existing PR + EXISTING_PR=$(gh pr list --repo "${FULL_REPO}" --head "${BRANCH}" --json url -q '.[0].url') + echo " ⚠️ PR already exists: ${EXISTING_PR}" + RESULTS["${repo}"]="EXISTS: ${EXISTING_PR}" + ((SUCCESS_COUNT++)) + else + echo " ❌ Failed to create PR" + RESULTS["${repo}"]="FAILED: Could not create PR" + ((FAIL_COUNT++)) + fi + + cd - > /dev/null + done + + # Final summary + echo "" + echo "================================================" + echo "📊 SUMMARY" + echo "================================================" + echo "Total repositories: ${#REPOS[@]}" + echo "✅ Successful: ${SUCCESS_COUNT}" + echo "⏭️ Skipped: ${SKIP_COUNT}" + echo "❌ Failed: ${FAIL_COUNT}" + + # Detailed results + echo "" + echo "📝 Detailed Results:" + echo "-------------------" + for repo in "${!RESULTS[@]}"; do + status="${RESULTS[$repo]}" + if [[ $status == SUCCESS* ]]; then + echo "✅ ${repo}: ${status}" + elif [[ $status == SKIPPED* ]] || [[ $status == EXISTS* ]]; then + echo "⏭️ ${repo}: ${status}" + elif [[ $status == "DRY RUN"* ]]; then + echo "🔍 ${repo}: ${status}" + else + echo "❌ ${repo}: ${status}" + fi + done | sort + + # Set job summary + cat >> $GITHUB_STEP_SUMMARY << EOF + # fsc-evm Version Update Summary + + **Version:** ${VERSION} + **Total Repositories:** ${#REPOS[@]} + + | Status | Count | + |--------|-------| + | ✅ Successful | ${SUCCESS_COUNT} | + | ⏭️ Skipped | ${SKIP_COUNT} | + | ❌ Failed | ${FAIL_COUNT} | + + ## Pull Requests Created + + EOF + + # Add PR links + for repo in "${!RESULTS[@]}"; do + status="${RESULTS[$repo]}" + if [[ $status == SUCCESS* ]]; then + url="${status#SUCCESS: }" + echo "- [${repo}](${url})" >> $GITHUB_STEP_SUMMARY + fi + done | sort >> $GITHUB_STEP_SUMMARY + + # Exit with error if any failed + if [ $FAIL_COUNT -gt 0 ]; then echo "" - echo "## Pull Requests Created" + echo "❌ Some repositories failed to update" + exit 1 + else echo "" - for repo in "${!RESULTS[@]}"; do - status="${RESULTS[$repo]}" - if [[ $status == SUCCESS* ]]; then - url="${status#SUCCESS: }" - echo "- [${repo}](${url})" - fi - done | sort - } >> $GITHUB_STEP_SUMMARY + echo "✨ All repositories processed successfully!" + fi\n' + PR_BODY+="This PR updates the fsc-evm package version from ${CURRENT_VERSION} to ${VERSION}." + + # Create PR and capture output + PR_OUTPUT=$(gh pr create \ + --repo "${FULL_REPO}" \ + --title "chore: update fsc-evm to ${VERSION}" \ + --body "${PR_BODY}" \ + --base main \ + --head "${BRANCH}" 2>&1) || true + + if echo "$PR_OUTPUT" | grep -q "github.com"; then + PR_URL=$(echo "$PR_OUTPUT" | grep -o 'https://github.com/[^ ]*' | head -1) + echo " ✅ PR created: ${PR_URL}" + RESULTS["${repo}"]="SUCCESS: ${PR_URL}" + ((SUCCESS_COUNT++)) + elif echo "$PR_OUTPUT" | grep -q "already exists"; then + # Get existing PR + EXISTING_PR=$(gh pr list --repo "${FULL_REPO}" --head "${BRANCH}" --json url -q '.[0].url') + echo " ⚠️ PR already exists: ${EXISTING_PR}" + RESULTS["${repo}"]="EXISTS: ${EXISTING_PR}" + ((SUCCESS_COUNT++)) + else + echo " ❌ Failed to create PR" + RESULTS["${repo}"]="FAILED: Could not create PR" + ((FAIL_COUNT++)) + fi + + cd - > /dev/null + done + + # Final summary + echo "" + echo "================================================" + echo "📊 SUMMARY" + echo "================================================" + echo "Total repositories: ${#REPOS[@]}" + echo "✅ Successful: ${SUCCESS_COUNT}" + echo "⏭️ Skipped: ${SKIP_COUNT}" + echo "❌ Failed: ${FAIL_COUNT}" + + # Detailed results + echo "" + echo "📝 Detailed Results:" + echo "-------------------" + for repo in "${!RESULTS[@]}"; do + status="${RESULTS[$repo]}" + if [[ $status == SUCCESS* ]]; then + echo "✅ ${repo}: ${status}" + elif [[ $status == SKIPPED* ]] || [[ $status == EXISTS* ]]; then + echo "⏭️ ${repo}: ${status}" + elif [[ $status == "DRY RUN"* ]]; then + echo "🔍 ${repo}: ${status}" + else + echo "❌ ${repo}: ${status}" + fi + done | sort + + # Set job summary + cat >> $GITHUB_STEP_SUMMARY << EOF + # fsc-evm Version Update Summary + + **Version:** ${VERSION} + **Total Repositories:** ${#REPOS[@]} + + | Status | Count | + |--------|-------| + | ✅ Successful | ${SUCCESS_COUNT} | + | ⏭️ Skipped | ${SKIP_COUNT} | + | ❌ Failed | ${FAIL_COUNT} | + + ## Pull Requests Created + + EOF + + # Add PR links + for repo in "${!RESULTS[@]}"; do + status="${RESULTS[$repo]}" + if [[ $status == SUCCESS* ]]; then + url="${status#SUCCESS: }" + echo "- [${repo}](${url})" >> $GITHUB_STEP_SUMMARY + fi + done | sort >> $GITHUB_STEP_SUMMARY + + # Exit with error if any failed + if [ $FAIL_COUNT -gt 0 ]; then + echo "" + echo "❌ Some repositories failed to update" + exit 1 + else + echo "" + echo "✨ All repositories processed successfully!" + fi\n' + + # Create PR and capture output + PR_OUTPUT=$(gh pr create \ + --repo "${FULL_REPO}" \ + --title "chore: update fsc-evm to ${VERSION}" \ + --body "${PR_BODY}" \ + --base main \ + --head "${BRANCH}" 2>&1) || true + + if echo "$PR_OUTPUT" | grep -q "github.com"; then + PR_URL=$(echo "$PR_OUTPUT" | grep -o 'https://github.com/[^ ]*' | head -1) + echo " ✅ PR created: ${PR_URL}" + RESULTS["${repo}"]="SUCCESS: ${PR_URL}" + ((SUCCESS_COUNT++)) + elif echo "$PR_OUTPUT" | grep -q "already exists"; then + # Get existing PR + EXISTING_PR=$(gh pr list --repo "${FULL_REPO}" --head "${BRANCH}" --json url -q '.[0].url') + echo " ⚠️ PR already exists: ${EXISTING_PR}" + RESULTS["${repo}"]="EXISTS: ${EXISTING_PR}" + ((SUCCESS_COUNT++)) + else + echo " ❌ Failed to create PR" + RESULTS["${repo}"]="FAILED: Could not create PR" + ((FAIL_COUNT++)) + fi + + cd - > /dev/null + done + + # Final summary + echo "" + echo "================================================" + echo "📊 SUMMARY" + echo "================================================" + echo "Total repositories: ${#REPOS[@]}" + echo "✅ Successful: ${SUCCESS_COUNT}" + echo "⏭️ Skipped: ${SKIP_COUNT}" + echo "❌ Failed: ${FAIL_COUNT}" + + # Detailed results + echo "" + echo "📝 Detailed Results:" + echo "-------------------" + for repo in "${!RESULTS[@]}"; do + status="${RESULTS[$repo]}" + if [[ $status == SUCCESS* ]]; then + echo "✅ ${repo}: ${status}" + elif [[ $status == SKIPPED* ]] || [[ $status == EXISTS* ]]; then + echo "⏭️ ${repo}: ${status}" + elif [[ $status == "DRY RUN"* ]]; then + echo "🔍 ${repo}: ${status}" + else + echo "❌ ${repo}: ${status}" + fi + done | sort + + # Set job summary + cat >> $GITHUB_STEP_SUMMARY << EOF + # fsc-evm Version Update Summary + + **Version:** ${VERSION} + **Total Repositories:** ${#REPOS[@]} + + | Status | Count | + |--------|-------| + | ✅ Successful | ${SUCCESS_COUNT} | + | ⏭️ Skipped | ${SKIP_COUNT} | + | ❌ Failed | ${FAIL_COUNT} | + + ## Pull Requests Created + + EOF + + # Add PR links + for repo in "${!RESULTS[@]}"; do + status="${RESULTS[$repo]}" + if [[ $status == SUCCESS* ]]; then + url="${status#SUCCESS: }" + echo "- [${repo}](${url})" >> $GITHUB_STEP_SUMMARY + fi + done | sort >> $GITHUB_STEP_SUMMARY + + # Exit with error if any failed + if [ $FAIL_COUNT -gt 0 ]; then + echo "" + echo "❌ Some repositories failed to update" + exit 1 + else + echo "" + echo "✨ All repositories processed successfully!" + fi\n' + PR_BODY+="### Changes" + + # Create PR and capture output + PR_OUTPUT=$(gh pr create \ + --repo "${FULL_REPO}" \ + --title "chore: update fsc-evm to ${VERSION}" \ + --body "${PR_BODY}" \ + --base main \ + --head "${BRANCH}" 2>&1) || true + + if echo "$PR_OUTPUT" | grep -q "github.com"; then + PR_URL=$(echo "$PR_OUTPUT" | grep -o 'https://github.com/[^ ]*' | head -1) + echo " ✅ PR created: ${PR_URL}" + RESULTS["${repo}"]="SUCCESS: ${PR_URL}" + ((SUCCESS_COUNT++)) + elif echo "$PR_OUTPUT" | grep -q "already exists"; then + # Get existing PR + EXISTING_PR=$(gh pr list --repo "${FULL_REPO}" --head "${BRANCH}" --json url -q '.[0].url') + echo " ⚠️ PR already exists: ${EXISTING_PR}" + RESULTS["${repo}"]="EXISTS: ${EXISTING_PR}" + ((SUCCESS_COUNT++)) + else + echo " ❌ Failed to create PR" + RESULTS["${repo}"]="FAILED: Could not create PR" + ((FAIL_COUNT++)) + fi + + cd - > /dev/null + done + + # Final summary + echo "" + echo "================================================" + echo "📊 SUMMARY" + echo "================================================" + echo "Total repositories: ${#REPOS[@]}" + echo "✅ Successful: ${SUCCESS_COUNT}" + echo "⏭️ Skipped: ${SKIP_COUNT}" + echo "❌ Failed: ${FAIL_COUNT}" + + # Detailed results + echo "" + echo "📝 Detailed Results:" + echo "-------------------" + for repo in "${!RESULTS[@]}"; do + status="${RESULTS[$repo]}" + if [[ $status == SUCCESS* ]]; then + echo "✅ ${repo}: ${status}" + elif [[ $status == SKIPPED* ]] || [[ $status == EXISTS* ]]; then + echo "⏭️ ${repo}: ${status}" + elif [[ $status == "DRY RUN"* ]]; then + echo "🔍 ${repo}: ${status}" + else + echo "❌ ${repo}: ${status}" + fi + done | sort + + # Set job summary + cat >> $GITHUB_STEP_SUMMARY << EOF + # fsc-evm Version Update Summary + + **Version:** ${VERSION} + **Total Repositories:** ${#REPOS[@]} + + | Status | Count | + |--------|-------| + | ✅ Successful | ${SUCCESS_COUNT} | + | ⏭️ Skipped | ${SKIP_COUNT} | + | ❌ Failed | ${FAIL_COUNT} | + + ## Pull Requests Created + + EOF + + # Add PR links + for repo in "${!RESULTS[@]}"; do + status="${RESULTS[$repo]}" + if [[ $status == SUCCESS* ]]; then + url="${status#SUCCESS: }" + echo "- [${repo}](${url})" >> $GITHUB_STEP_SUMMARY + fi + done | sort >> $GITHUB_STEP_SUMMARY + + # Exit with error if any failed + if [ $FAIL_COUNT -gt 0 ]; then + echo "" + echo "❌ Some repositories failed to update" + exit 1 + else + echo "" + echo "✨ All repositories processed successfully!" + fi\n' + PR_BODY+='```diff' + + # Create PR and capture output + PR_OUTPUT=$(gh pr create \ + --repo "${FULL_REPO}" \ + --title "chore: update fsc-evm to ${VERSION}" \ + --body "${PR_BODY}" \ + --base main \ + --head "${BRANCH}" 2>&1) || true + + if echo "$PR_OUTPUT" | grep -q "github.com"; then + PR_URL=$(echo "$PR_OUTPUT" | grep -o 'https://github.com/[^ ]*' | head -1) + echo " ✅ PR created: ${PR_URL}" + RESULTS["${repo}"]="SUCCESS: ${PR_URL}" + ((SUCCESS_COUNT++)) + elif echo "$PR_OUTPUT" | grep -q "already exists"; then + # Get existing PR + EXISTING_PR=$(gh pr list --repo "${FULL_REPO}" --head "${BRANCH}" --json url -q '.[0].url') + echo " ⚠️ PR already exists: ${EXISTING_PR}" + RESULTS["${repo}"]="EXISTS: ${EXISTING_PR}" + ((SUCCESS_COUNT++)) + else + echo " ❌ Failed to create PR" + RESULTS["${repo}"]="FAILED: Could not create PR" + ((FAIL_COUNT++)) + fi + + cd - > /dev/null + done + + # Final summary + echo "" + echo "================================================" + echo "📊 SUMMARY" + echo "================================================" + echo "Total repositories: ${#REPOS[@]}" + echo "✅ Successful: ${SUCCESS_COUNT}" + echo "⏭️ Skipped: ${SKIP_COUNT}" + echo "❌ Failed: ${FAIL_COUNT}" + + # Detailed results + echo "" + echo "📝 Detailed Results:" + echo "-------------------" + for repo in "${!RESULTS[@]}"; do + status="${RESULTS[$repo]}" + if [[ $status == SUCCESS* ]]; then + echo "✅ ${repo}: ${status}" + elif [[ $status == SKIPPED* ]] || [[ $status == EXISTS* ]]; then + echo "⏭️ ${repo}: ${status}" + elif [[ $status == "DRY RUN"* ]]; then + echo "🔍 ${repo}: ${status}" + else + echo "❌ ${repo}: ${status}" + fi + done | sort + + # Set job summary + cat >> $GITHUB_STEP_SUMMARY << EOF + # fsc-evm Version Update Summary + + **Version:** ${VERSION} + **Total Repositories:** ${#REPOS[@]} + + | Status | Count | + |--------|-------| + | ✅ Successful | ${SUCCESS_COUNT} | + | ⏭️ Skipped | ${SKIP_COUNT} | + | ❌ Failed | ${FAIL_COUNT} | + + ## Pull Requests Created + + EOF + + # Add PR links + for repo in "${!RESULTS[@]}"; do + status="${RESULTS[$repo]}" + if [[ $status == SUCCESS* ]]; then + url="${status#SUCCESS: }" + echo "- [${repo}](${url})" >> $GITHUB_STEP_SUMMARY + fi + done | sort >> $GITHUB_STEP_SUMMARY + + # Exit with error if any failed + if [ $FAIL_COUNT -gt 0 ]; then + echo "" + echo "❌ Some repositories failed to update" + exit 1 + else + echo "" + echo "✨ All repositories processed successfully!" + fi\n' + PR_BODY+="packages:" + + # Create PR and capture output + PR_OUTPUT=$(gh pr create \ + --repo "${FULL_REPO}" \ + --title "chore: update fsc-evm to ${VERSION}" \ + --body "${PR_BODY}" \ + --base main \ + --head "${BRANCH}" 2>&1) || true + + if echo "$PR_OUTPUT" | grep -q "github.com"; then + PR_URL=$(echo "$PR_OUTPUT" | grep -o 'https://github.com/[^ ]*' | head -1) + echo " ✅ PR created: ${PR_URL}" + RESULTS["${repo}"]="SUCCESS: ${PR_URL}" + ((SUCCESS_COUNT++)) + elif echo "$PR_OUTPUT" | grep -q "already exists"; then + # Get existing PR + EXISTING_PR=$(gh pr list --repo "${FULL_REPO}" --head "${BRANCH}" --json url -q '.[0].url') + echo " ⚠️ PR already exists: ${EXISTING_PR}" + RESULTS["${repo}"]="EXISTS: ${EXISTING_PR}" + ((SUCCESS_COUNT++)) + else + echo " ❌ Failed to create PR" + RESULTS["${repo}"]="FAILED: Could not create PR" + ((FAIL_COUNT++)) + fi + + cd - > /dev/null + done + + # Final summary + echo "" + echo "================================================" + echo "📊 SUMMARY" + echo "================================================" + echo "Total repositories: ${#REPOS[@]}" + echo "✅ Successful: ${SUCCESS_COUNT}" + echo "⏭️ Skipped: ${SKIP_COUNT}" + echo "❌ Failed: ${FAIL_COUNT}" + + # Detailed results + echo "" + echo "📝 Detailed Results:" + echo "-------------------" + for repo in "${!RESULTS[@]}"; do + status="${RESULTS[$repo]}" + if [[ $status == SUCCESS* ]]; then + echo "✅ ${repo}: ${status}" + elif [[ $status == SKIPPED* ]] || [[ $status == EXISTS* ]]; then + echo "⏭️ ${repo}: ${status}" + elif [[ $status == "DRY RUN"* ]]; then + echo "🔍 ${repo}: ${status}" + else + echo "❌ ${repo}: ${status}" + fi + done | sort + + # Set job summary + cat >> $GITHUB_STEP_SUMMARY << EOF + # fsc-evm Version Update Summary + + **Version:** ${VERSION} + **Total Repositories:** ${#REPOS[@]} + + | Status | Count | + |--------|-------| + | ✅ Successful | ${SUCCESS_COUNT} | + | ⏭️ Skipped | ${SKIP_COUNT} | + | ❌ Failed | ${FAIL_COUNT} | + + ## Pull Requests Created + + EOF + + # Add PR links + for repo in "${!RESULTS[@]}"; do + status="${RESULTS[$repo]}" + if [[ $status == SUCCESS* ]]; then + url="${status#SUCCESS: }" + echo "- [${repo}](${url})" >> $GITHUB_STEP_SUMMARY + fi + done | sort >> $GITHUB_STEP_SUMMARY + + # Exit with error if any failed + if [ $FAIL_COUNT -gt 0 ]; then + echo "" + echo "❌ Some repositories failed to update" + exit 1 + else + echo "" + echo "✨ All repositories processed successfully!" + fi\n' + PR_BODY+=" - git: https://github.com/FlipsideCrypto/fsc-evm.git" + + # Create PR and capture output + PR_OUTPUT=$(gh pr create \ + --repo "${FULL_REPO}" \ + --title "chore: update fsc-evm to ${VERSION}" \ + --body "${PR_BODY}" \ + --base main \ + --head "${BRANCH}" 2>&1) || true + + if echo "$PR_OUTPUT" | grep -q "github.com"; then + PR_URL=$(echo "$PR_OUTPUT" | grep -o 'https://github.com/[^ ]*' | head -1) + echo " ✅ PR created: ${PR_URL}" + RESULTS["${repo}"]="SUCCESS: ${PR_URL}" + ((SUCCESS_COUNT++)) + elif echo "$PR_OUTPUT" | grep -q "already exists"; then + # Get existing PR + EXISTING_PR=$(gh pr list --repo "${FULL_REPO}" --head "${BRANCH}" --json url -q '.[0].url') + echo " ⚠️ PR already exists: ${EXISTING_PR}" + RESULTS["${repo}"]="EXISTS: ${EXISTING_PR}" + ((SUCCESS_COUNT++)) + else + echo " ❌ Failed to create PR" + RESULTS["${repo}"]="FAILED: Could not create PR" + ((FAIL_COUNT++)) + fi + + cd - > /dev/null + done + + # Final summary + echo "" + echo "================================================" + echo "📊 SUMMARY" + echo "================================================" + echo "Total repositories: ${#REPOS[@]}" + echo "✅ Successful: ${SUCCESS_COUNT}" + echo "⏭️ Skipped: ${SKIP_COUNT}" + echo "❌ Failed: ${FAIL_COUNT}" + + # Detailed results + echo "" + echo "📝 Detailed Results:" + echo "-------------------" + for repo in "${!RESULTS[@]}"; do + status="${RESULTS[$repo]}" + if [[ $status == SUCCESS* ]]; then + echo "✅ ${repo}: ${status}" + elif [[ $status == SKIPPED* ]] || [[ $status == EXISTS* ]]; then + echo "⏭️ ${repo}: ${status}" + elif [[ $status == "DRY RUN"* ]]; then + echo "🔍 ${repo}: ${status}" + else + echo "❌ ${repo}: ${status}" + fi + done | sort + + # Set job summary + cat >> $GITHUB_STEP_SUMMARY << EOF + # fsc-evm Version Update Summary + + **Version:** ${VERSION} + **Total Repositories:** ${#REPOS[@]} + + | Status | Count | + |--------|-------| + | ✅ Successful | ${SUCCESS_COUNT} | + | ⏭️ Skipped | ${SKIP_COUNT} | + | ❌ Failed | ${FAIL_COUNT} | + + ## Pull Requests Created + + EOF + + # Add PR links + for repo in "${!RESULTS[@]}"; do + status="${RESULTS[$repo]}" + if [[ $status == SUCCESS* ]]; then + url="${status#SUCCESS: }" + echo "- [${repo}](${url})" >> $GITHUB_STEP_SUMMARY + fi + done | sort >> $GITHUB_STEP_SUMMARY + + # Exit with error if any failed + if [ $FAIL_COUNT -gt 0 ]; then + echo "" + echo "❌ Some repositories failed to update" + exit 1 + else + echo "" + echo "✨ All repositories processed successfully!" + fi\n' + PR_BODY+="- revision: ${CURRENT_VERSION}" + + # Create PR and capture output + PR_OUTPUT=$(gh pr create \ + --repo "${FULL_REPO}" \ + --title "chore: update fsc-evm to ${VERSION}" \ + --body "${PR_BODY}" \ + --base main \ + --head "${BRANCH}" 2>&1) || true + + if echo "$PR_OUTPUT" | grep -q "github.com"; then + PR_URL=$(echo "$PR_OUTPUT" | grep -o 'https://github.com/[^ ]*' | head -1) + echo " ✅ PR created: ${PR_URL}" + RESULTS["${repo}"]="SUCCESS: ${PR_URL}" + ((SUCCESS_COUNT++)) + elif echo "$PR_OUTPUT" | grep -q "already exists"; then + # Get existing PR + EXISTING_PR=$(gh pr list --repo "${FULL_REPO}" --head "${BRANCH}" --json url -q '.[0].url') + echo " ⚠️ PR already exists: ${EXISTING_PR}" + RESULTS["${repo}"]="EXISTS: ${EXISTING_PR}" + ((SUCCESS_COUNT++)) + else + echo " ❌ Failed to create PR" + RESULTS["${repo}"]="FAILED: Could not create PR" + ((FAIL_COUNT++)) + fi + + cd - > /dev/null + done + + # Final summary + echo "" + echo "================================================" + echo "📊 SUMMARY" + echo "================================================" + echo "Total repositories: ${#REPOS[@]}" + echo "✅ Successful: ${SUCCESS_COUNT}" + echo "⏭️ Skipped: ${SKIP_COUNT}" + echo "❌ Failed: ${FAIL_COUNT}" + + # Detailed results + echo "" + echo "📝 Detailed Results:" + echo "-------------------" + for repo in "${!RESULTS[@]}"; do + status="${RESULTS[$repo]}" + if [[ $status == SUCCESS* ]]; then + echo "✅ ${repo}: ${status}" + elif [[ $status == SKIPPED* ]] || [[ $status == EXISTS* ]]; then + echo "⏭️ ${repo}: ${status}" + elif [[ $status == "DRY RUN"* ]]; then + echo "🔍 ${repo}: ${status}" + else + echo "❌ ${repo}: ${status}" + fi + done | sort + + # Set job summary + cat >> $GITHUB_STEP_SUMMARY << EOF + # fsc-evm Version Update Summary + + **Version:** ${VERSION} + **Total Repositories:** ${#REPOS[@]} + + | Status | Count | + |--------|-------| + | ✅ Successful | ${SUCCESS_COUNT} | + | ⏭️ Skipped | ${SKIP_COUNT} | + | ❌ Failed | ${FAIL_COUNT} | + + ## Pull Requests Created + + EOF + + # Add PR links + for repo in "${!RESULTS[@]}"; do + status="${RESULTS[$repo]}" + if [[ $status == SUCCESS* ]]; then + url="${status#SUCCESS: }" + echo "- [${repo}](${url})" >> $GITHUB_STEP_SUMMARY + fi + done | sort >> $GITHUB_STEP_SUMMARY + + # Exit with error if any failed + if [ $FAIL_COUNT -gt 0 ]; then + echo "" + echo "❌ Some repositories failed to update" + exit 1 + else + echo "" + echo "✨ All repositories processed successfully!" + fi\n' + PR_BODY+="+ revision: ${VERSION}" + + # Create PR and capture output + PR_OUTPUT=$(gh pr create \ + --repo "${FULL_REPO}" \ + --title "chore: update fsc-evm to ${VERSION}" \ + --body "${PR_BODY}" \ + --base main \ + --head "${BRANCH}" 2>&1) || true + + if echo "$PR_OUTPUT" | grep -q "github.com"; then + PR_URL=$(echo "$PR_OUTPUT" | grep -o 'https://github.com/[^ ]*' | head -1) + echo " ✅ PR created: ${PR_URL}" + RESULTS["${repo}"]="SUCCESS: ${PR_URL}" + ((SUCCESS_COUNT++)) + elif echo "$PR_OUTPUT" | grep -q "already exists"; then + # Get existing PR + EXISTING_PR=$(gh pr list --repo "${FULL_REPO}" --head "${BRANCH}" --json url -q '.[0].url') + echo " ⚠️ PR already exists: ${EXISTING_PR}" + RESULTS["${repo}"]="EXISTS: ${EXISTING_PR}" + ((SUCCESS_COUNT++)) + else + echo " ❌ Failed to create PR" + RESULTS["${repo}"]="FAILED: Could not create PR" + ((FAIL_COUNT++)) + fi + + cd - > /dev/null + done + + # Final summary + echo "" + echo "================================================" + echo "📊 SUMMARY" + echo "================================================" + echo "Total repositories: ${#REPOS[@]}" + echo "✅ Successful: ${SUCCESS_COUNT}" + echo "⏭️ Skipped: ${SKIP_COUNT}" + echo "❌ Failed: ${FAIL_COUNT}" + + # Detailed results + echo "" + echo "📝 Detailed Results:" + echo "-------------------" + for repo in "${!RESULTS[@]}"; do + status="${RESULTS[$repo]}" + if [[ $status == SUCCESS* ]]; then + echo "✅ ${repo}: ${status}" + elif [[ $status == SKIPPED* ]] || [[ $status == EXISTS* ]]; then + echo "⏭️ ${repo}: ${status}" + elif [[ $status == "DRY RUN"* ]]; then + echo "🔍 ${repo}: ${status}" + else + echo "❌ ${repo}: ${status}" + fi + done | sort + + # Set job summary + cat >> $GITHUB_STEP_SUMMARY << EOF + # fsc-evm Version Update Summary + + **Version:** ${VERSION} + **Total Repositories:** ${#REPOS[@]} + + | Status | Count | + |--------|-------| + | ✅ Successful | ${SUCCESS_COUNT} | + | ⏭️ Skipped | ${SKIP_COUNT} | + | ❌ Failed | ${FAIL_COUNT} | + + ## Pull Requests Created + + EOF + + # Add PR links + for repo in "${!RESULTS[@]}"; do + status="${RESULTS[$repo]}" + if [[ $status == SUCCESS* ]]; then + url="${status#SUCCESS: }" + echo "- [${repo}](${url})" >> $GITHUB_STEP_SUMMARY + fi + done | sort >> $GITHUB_STEP_SUMMARY + + # Exit with error if any failed + if [ $FAIL_COUNT -gt 0 ]; then + echo "" + echo "❌ Some repositories failed to update" + exit 1 + else + echo "" + echo "✨ All repositories processed successfully!" + fi\n' + PR_BODY+='```' + + # Create PR and capture output + PR_OUTPUT=$(gh pr create \ + --repo "${FULL_REPO}" \ + --title "chore: update fsc-evm to ${VERSION}" \ + --body "${PR_BODY}" \ + --base main \ + --head "${BRANCH}" 2>&1) || true + + if echo "$PR_OUTPUT" | grep -q "github.com"; then + PR_URL=$(echo "$PR_OUTPUT" | grep -o 'https://github.com/[^ ]*' | head -1) + echo " ✅ PR created: ${PR_URL}" + RESULTS["${repo}"]="SUCCESS: ${PR_URL}" + ((SUCCESS_COUNT++)) + elif echo "$PR_OUTPUT" | grep -q "already exists"; then + # Get existing PR + EXISTING_PR=$(gh pr list --repo "${FULL_REPO}" --head "${BRANCH}" --json url -q '.[0].url') + echo " ⚠️ PR already exists: ${EXISTING_PR}" + RESULTS["${repo}"]="EXISTS: ${EXISTING_PR}" + ((SUCCESS_COUNT++)) + else + echo " ❌ Failed to create PR" + RESULTS["${repo}"]="FAILED: Could not create PR" + ((FAIL_COUNT++)) + fi + + cd - > /dev/null + done + + # Final summary + echo "" + echo "================================================" + echo "📊 SUMMARY" + echo "================================================" + echo "Total repositories: ${#REPOS[@]}" + echo "✅ Successful: ${SUCCESS_COUNT}" + echo "⏭️ Skipped: ${SKIP_COUNT}" + echo "❌ Failed: ${FAIL_COUNT}" + + # Detailed results + echo "" + echo "📝 Detailed Results:" + echo "-------------------" + for repo in "${!RESULTS[@]}"; do + status="${RESULTS[$repo]}" + if [[ $status == SUCCESS* ]]; then + echo "✅ ${repo}: ${status}" + elif [[ $status == SKIPPED* ]] || [[ $status == EXISTS* ]]; then + echo "⏭️ ${repo}: ${status}" + elif [[ $status == "DRY RUN"* ]]; then + echo "🔍 ${repo}: ${status}" + else + echo "❌ ${repo}: ${status}" + fi + done | sort + + # Set job summary + cat >> $GITHUB_STEP_SUMMARY << EOF + # fsc-evm Version Update Summary + + **Version:** ${VERSION} + **Total Repositories:** ${#REPOS[@]} + + | Status | Count | + |--------|-------| + | ✅ Successful | ${SUCCESS_COUNT} | + | ⏭️ Skipped | ${SKIP_COUNT} | + | ❌ Failed | ${FAIL_COUNT} | + + ## Pull Requests Created + + EOF + + # Add PR links + for repo in "${!RESULTS[@]}"; do + status="${RESULTS[$repo]}" + if [[ $status == SUCCESS* ]]; then + url="${status#SUCCESS: }" + echo "- [${repo}](${url})" >> $GITHUB_STEP_SUMMARY + fi + done | sort >> $GITHUB_STEP_SUMMARY + + # Exit with error if any failed + if [ $FAIL_COUNT -gt 0 ]; then + echo "" + echo "❌ Some repositories failed to update" + exit 1 + else + echo "" + echo "✨ All repositories processed successfully!" + fi\n' + + # Create PR and capture output + PR_OUTPUT=$(gh pr create \ + --repo "${FULL_REPO}" \ + --title "chore: update fsc-evm to ${VERSION}" \ + --body "${PR_BODY}" \ + --base main \ + --head "${BRANCH}" 2>&1) || true + + if echo "$PR_OUTPUT" | grep -q "github.com"; then + PR_URL=$(echo "$PR_OUTPUT" | grep -o 'https://github.com/[^ ]*' | head -1) + echo " ✅ PR created: ${PR_URL}" + RESULTS["${repo}"]="SUCCESS: ${PR_URL}" + ((SUCCESS_COUNT++)) + elif echo "$PR_OUTPUT" | grep -q "already exists"; then + # Get existing PR + EXISTING_PR=$(gh pr list --repo "${FULL_REPO}" --head "${BRANCH}" --json url -q '.[0].url') + echo " ⚠️ PR already exists: ${EXISTING_PR}" + RESULTS["${repo}"]="EXISTS: ${EXISTING_PR}" + ((SUCCESS_COUNT++)) + else + echo " ❌ Failed to create PR" + RESULTS["${repo}"]="FAILED: Could not create PR" + ((FAIL_COUNT++)) + fi + + cd - > /dev/null + done + + # Final summary + echo "" + echo "================================================" + echo "📊 SUMMARY" + echo "================================================" + echo "Total repositories: ${#REPOS[@]}" + echo "✅ Successful: ${SUCCESS_COUNT}" + echo "⏭️ Skipped: ${SKIP_COUNT}" + echo "❌ Failed: ${FAIL_COUNT}" + + # Detailed results + echo "" + echo "📝 Detailed Results:" + echo "-------------------" + for repo in "${!RESULTS[@]}"; do + status="${RESULTS[$repo]}" + if [[ $status == SUCCESS* ]]; then + echo "✅ ${repo}: ${status}" + elif [[ $status == SKIPPED* ]] || [[ $status == EXISTS* ]]; then + echo "⏭️ ${repo}: ${status}" + elif [[ $status == "DRY RUN"* ]]; then + echo "🔍 ${repo}: ${status}" + else + echo "❌ ${repo}: ${status}" + fi + done | sort + + # Set job summary + cat >> $GITHUB_STEP_SUMMARY << EOF + # fsc-evm Version Update Summary + + **Version:** ${VERSION} + **Total Repositories:** ${#REPOS[@]} + + | Status | Count | + |--------|-------| + | ✅ Successful | ${SUCCESS_COUNT} | + | ⏭️ Skipped | ${SKIP_COUNT} | + | ❌ Failed | ${FAIL_COUNT} | + + ## Pull Requests Created + + EOF + + # Add PR links + for repo in "${!RESULTS[@]}"; do + status="${RESULTS[$repo]}" + if [[ $status == SUCCESS* ]]; then + url="${status#SUCCESS: }" + echo "- [${repo}](${url})" >> $GITHUB_STEP_SUMMARY + fi + done | sort >> $GITHUB_STEP_SUMMARY + + # Exit with error if any failed + if [ $FAIL_COUNT -gt 0 ]; then + echo "" + echo "❌ Some repositories failed to update" + exit 1 + else + echo "" + echo "✨ All repositories processed successfully!" + fi\n' + PR_BODY+="---" + + # Create PR and capture output + PR_OUTPUT=$(gh pr create \ + --repo "${FULL_REPO}" \ + --title "chore: update fsc-evm to ${VERSION}" \ + --body "${PR_BODY}" \ + --base main \ + --head "${BRANCH}" 2>&1) || true + + if echo "$PR_OUTPUT" | grep -q "github.com"; then + PR_URL=$(echo "$PR_OUTPUT" | grep -o 'https://github.com/[^ ]*' | head -1) + echo " ✅ PR created: ${PR_URL}" + RESULTS["${repo}"]="SUCCESS: ${PR_URL}" + ((SUCCESS_COUNT++)) + elif echo "$PR_OUTPUT" | grep -q "already exists"; then + # Get existing PR + EXISTING_PR=$(gh pr list --repo "${FULL_REPO}" --head "${BRANCH}" --json url -q '.[0].url') + echo " ⚠️ PR already exists: ${EXISTING_PR}" + RESULTS["${repo}"]="EXISTS: ${EXISTING_PR}" + ((SUCCESS_COUNT++)) + else + echo " ❌ Failed to create PR" + RESULTS["${repo}"]="FAILED: Could not create PR" + ((FAIL_COUNT++)) + fi + + cd - > /dev/null + done + + # Final summary + echo "" + echo "================================================" + echo "📊 SUMMARY" + echo "================================================" + echo "Total repositories: ${#REPOS[@]}" + echo "✅ Successful: ${SUCCESS_COUNT}" + echo "⏭️ Skipped: ${SKIP_COUNT}" + echo "❌ Failed: ${FAIL_COUNT}" + + # Detailed results + echo "" + echo "📝 Detailed Results:" + echo "-------------------" + for repo in "${!RESULTS[@]}"; do + status="${RESULTS[$repo]}" + if [[ $status == SUCCESS* ]]; then + echo "✅ ${repo}: ${status}" + elif [[ $status == SKIPPED* ]] || [[ $status == EXISTS* ]]; then + echo "⏭️ ${repo}: ${status}" + elif [[ $status == "DRY RUN"* ]]; then + echo "🔍 ${repo}: ${status}" + else + echo "❌ ${repo}: ${status}" + fi + done | sort + + # Set job summary + cat >> $GITHUB_STEP_SUMMARY << EOF + # fsc-evm Version Update Summary + + **Version:** ${VERSION} + **Total Repositories:** ${#REPOS[@]} + + | Status | Count | + |--------|-------| + | ✅ Successful | ${SUCCESS_COUNT} | + | ⏭️ Skipped | ${SKIP_COUNT} | + | ❌ Failed | ${FAIL_COUNT} | + + ## Pull Requests Created + + EOF + + # Add PR links + for repo in "${!RESULTS[@]}"; do + status="${RESULTS[$repo]}" + if [[ $status == SUCCESS* ]]; then + url="${status#SUCCESS: }" + echo "- [${repo}](${url})" >> $GITHUB_STEP_SUMMARY + fi + done | sort >> $GITHUB_STEP_SUMMARY + + # Exit with error if any failed + if [ $FAIL_COUNT -gt 0 ]; then + echo "" + echo "❌ Some repositories failed to update" + exit 1 + else + echo "" + echo "✨ All repositories processed successfully!" + fi\n' + PR_BODY+="*This PR was auto-generated by the fsc-evm version update workflow.*" + + # Create PR and capture output + PR_OUTPUT=$(gh pr create \ + --repo "${FULL_REPO}" \ + --title "chore: update fsc-evm to ${VERSION}" \ + --body "${PR_BODY}" \ + --base main \ + --head "${BRANCH}" 2>&1) || true + + if echo "$PR_OUTPUT" | grep -q "github.com"; then + PR_URL=$(echo "$PR_OUTPUT" | grep -o 'https://github.com/[^ ]*' | head -1) + echo " ✅ PR created: ${PR_URL}" + RESULTS["${repo}"]="SUCCESS: ${PR_URL}" + ((SUCCESS_COUNT++)) + elif echo "$PR_OUTPUT" | grep -q "already exists"; then + # Get existing PR + EXISTING_PR=$(gh pr list --repo "${FULL_REPO}" --head "${BRANCH}" --json url -q '.[0].url') + echo " ⚠️ PR already exists: ${EXISTING_PR}" + RESULTS["${repo}"]="EXISTS: ${EXISTING_PR}" + ((SUCCESS_COUNT++)) + else + echo " ❌ Failed to create PR" + RESULTS["${repo}"]="FAILED: Could not create PR" + ((FAIL_COUNT++)) + fi + + cd - > /dev/null + done + + # Final summary + echo "" + echo "================================================" + echo "📊 SUMMARY" + echo "================================================" + echo "Total repositories: ${#REPOS[@]}" + echo "✅ Successful: ${SUCCESS_COUNT}" + echo "⏭️ Skipped: ${SKIP_COUNT}" + echo "❌ Failed: ${FAIL_COUNT}" + + # Detailed results + echo "" + echo "📝 Detailed Results:" + echo "-------------------" + for repo in "${!RESULTS[@]}"; do + status="${RESULTS[$repo]}" + if [[ $status == SUCCESS* ]]; then + echo "✅ ${repo}: ${status}" + elif [[ $status == SKIPPED* ]] || [[ $status == EXISTS* ]]; then + echo "⏭️ ${repo}: ${status}" + elif [[ $status == "DRY RUN"* ]]; then + echo "🔍 ${repo}: ${status}" + else + echo "❌ ${repo}: ${status}" + fi + done | sort + + # Set job summary + cat >> $GITHUB_STEP_SUMMARY << EOF + # fsc-evm Version Update Summary + + **Version:** ${VERSION} + **Total Repositories:** ${#REPOS[@]} + + | Status | Count | + |--------|-------| + | ✅ Successful | ${SUCCESS_COUNT} | + | ⏭️ Skipped | ${SKIP_COUNT} | + | ❌ Failed | ${FAIL_COUNT} | + + ## Pull Requests Created + + EOF + + # Add PR links + for repo in "${!RESULTS[@]}"; do + status="${RESULTS[$repo]}" + if [[ $status == SUCCESS* ]]; then + url="${status#SUCCESS: }" + echo "- [${repo}](${url})" >> $GITHUB_STEP_SUMMARY + fi + done | sort >> $GITHUB_STEP_SUMMARY # Exit with error if any failed if [ $FAIL_COUNT -gt 0 ]; then