chore: debug #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Trigger Devin for New Chain Request Validation | |
| on: | |
| push: | |
| branches: | |
| - feat/devin-new-chains-workflow | |
| issues: | |
| types: [labeled] | |
| workflow_dispatch: | |
| inputs: | |
| issue_number: | |
| description: "Issue number for debugging" | |
| required: true | |
| type: string | |
| issue_title: | |
| description: "Issue title for debugging" | |
| required: true | |
| type: string | |
| issue_url: | |
| description: "Issue URL for debugging" | |
| required: true | |
| type: string | |
| issue_author: | |
| description: "Issue author username for debugging" | |
| required: true | |
| type: string | |
| issue_body: | |
| description: "Issue body content for debugging" | |
| required: true | |
| type: string | |
| label_name: | |
| description: 'Label name for debugging (should be "type: new chain request")' | |
| required: true | |
| type: string | |
| default: "type: new chain request" | |
| permissions: | |
| contents: read # Required to read issue content | |
| issues: read # Required to read issue details | |
| jobs: | |
| trigger-devin-chain-validation: | |
| # This job runs only if the issue was labeled with 'type: new chain request' OR if manually triggered | |
| if: | | |
| github.event.label.name == 'type: new chain request' || | |
| (github.event_name == 'workflow_dispatch' && inputs.label_name == 'type: new chain request') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Send Slack Notification for Chain Request Validation | |
| env: | |
| DEVIN_SLACK_WEBHOOK_URL: ${{ secrets.DEVIN_SLACK_WEBHOOK_URL }} | |
| DEVIN_SLACK_USER_ID: U08M9DKD4MC | |
| PROMPT_TEXT: | | |
| ## Context | |
| A new issue (#${{ github.event_name == 'workflow_dispatch' && inputs.issue_number || github.event.issue.number }}) has been labeled with "type: new chain request" in the ${{ github.repository }} repository. Your task is to validate this chain request for completeness and take appropriate action. | |
| **Issue Details:** | |
| - **Title**: ${{ github.event_name == 'workflow_dispatch' && inputs.issue_title || github.event.issue.title }} | |
| - **URL**: ${{ github.event_name == 'workflow_dispatch' && inputs.issue_url || github.event.issue.html_url }} | |
| - **Author**: ${{ github.event_name == 'workflow_dispatch' && inputs.issue_author || github.event.issue.user.login }} | |
| **Issue Body:** | |
| ${{ github.event_name == 'workflow_dispatch' && inputs.issue_body || github.event.issue.body }} | |
| ## Validation Requirements | |
| Please validate the chain request against the following complete example format: | |
| **Required Elements:** | |
| 1. **JSON-RPC spec for Wallets** - Only required if one doesn't already exist (link to existing spec or new spec) | |
| 2. **CASA namespace spec** - GitHub link to ChainAgnostic/namespaces specification | |
| 3. **namespaces** - The namespace identifier (e.g., "fil", "eip155") | |
| 4. **chains** - List of chains with their CAIP-2 identifiers (e.g. "Filecoin [mainnet] fil:f") | |
| 5. **RPC endpoints** - Working RPC endpoints for each chain | |
| 6. **SLIP-0044 coin type** - The registered coin type number | |
| 7. **References section** with: | |
| - Source of RPC endpoints (with working link) | |
| - Source of namespace chain information (with working link) | |
| 8. **Confirmation checkbox** - "I have read and understood the above clarification" must be checked | |
| ## Your Actions | |
| **If the request is INCOMPLETE or INVALID:** | |
| - Comment on the issue with a detailed summary of what is missing or incorrect | |
| - Be specific about which required elements are missing | |
| - Provide guidance on how to fix the issues | |
| - Use a helpful and constructive tone | |
| **If the request is COMPLETE and VALID:** | |
| - Create a pull request in the https://github.com/reown-com/web-monorepo/ repository | |
| - Use the title: "chore: add new chains" | |
| - Use this PR as a reference for structure and format: https://github.com/reown-com/web-monorepo/pull/1923 | |
| - Include all the chain information from the validated issue | |
| - Reference the original issue in the PR description | |
| ## Repositories Access Required | |
| * ${{ github.repository }} (for commenting on the issue if needed) | |
| * reown-com/web-monorepo (for creating the PR if request is valid) | |
| Please proceed with validating issue #${{ github.event_name == 'workflow_dispatch' && inputs.issue_number || github.event.issue.number }} and take the appropriate action based on your assessment. | |
| run: | | |
| # Exit on error | |
| set -e | |
| # Check if the Slack webhook URL is provided and not empty | |
| if [ -z "${DEVIN_SLACK_WEBHOOK_URL}" ]; then | |
| echo "Error: DEVIN_SLACK_WEBHOOK_URL is not set or is empty." | |
| echo "Please ensure this secret is configured in the repository settings (Secrets and variables > Actions)." | |
| exit 1 | |
| fi | |
| # PROMPT_TEXT is set in the 'env' block and should be fully expanded by GitHub Actions. | |
| # Construct the final message text for Slack. | |
| MESSAGE_TEXT="<@${DEVIN_SLACK_USER_ID}> ${PROMPT_TEXT}" | |
| # Create the JSON payload for Slack. | |
| # The --arg option in jq handles escaping special characters in MESSAGE_TEXT for valid JSON. | |
| echo "Attempting to create JSON payload..." | |
| JSON_PAYLOAD=$(jq -n --arg text "$MESSAGE_TEXT" '{text: $text}') | |
| JQ_EXIT_CODE=$? | |
| if [ $JQ_EXIT_CODE -ne 0 ]; then | |
| echo "Error: jq command failed to create JSON payload (Exit Code: $JQ_EXIT_CODE)." | |
| # Log a snippet of the message text to aid debugging, avoiding overly long logs. | |
| echo "Original Message Text (first 200 characters):" | |
| echo "${MESSAGE_TEXT:0:200}..." | |
| exit 1 | |
| fi | |
| echo "Sending Slack notification for Chain Request Validation." | |
| # Echo context information using direct GitHub context expressions for clarity and consistency. | |
| echo "Repository: ${{ github.repository }}" | |
| echo "Issue Number: #${{ github.event_name == 'workflow_dispatch' && inputs.issue_number || github.event.issue.number }}" | |
| echo "Issue Title: ${{ github.event_name == 'workflow_dispatch' && inputs.issue_title || github.event.issue.title }}" | |
| echo "Issue URL: ${{ github.event_name == 'workflow_dispatch' && inputs.issue_url || github.event.issue.html_url }}" | |
| echo "Label Added: ${{ github.event_name == 'workflow_dispatch' && inputs.label_name || github.event.label.name }}" | |
| echo "Trigger Type: ${{ github.event_name }}" | |
| # Send the notification to Slack using curl. | |
| # -s: silent mode (no progress meter). | |
| # -X POST: specifies the HTTP POST method. | |
| # -H "Content-Type: application/json": sets the content type header. | |
| # -d "$JSON_PAYLOAD": provides the JSON data for the request body. | |
| RESPONSE=$(curl -s -X POST \ | |
| -H "Content-Type: application/json" \ | |
| -d "$JSON_PAYLOAD" \ | |
| "${DEVIN_SLACK_WEBHOOK_URL}") | |
| CURL_EXIT_CODE=$? | |
| if [ $CURL_EXIT_CODE -ne 0 ]; then | |
| echo "Error: curl command failed to send Slack notification (Exit Code: $CURL_EXIT_CODE)." | |
| # RESPONSE might be empty or contain an error message from curl itself (e.g., if URL is malformed or network issue). | |
| echo "Curl response (if any): $RESPONSE" | |
| exit 1 | |
| fi | |
| # Check the content of the response from the Slack API. | |
| # A successful Slack webhook POST request typically returns the string "ok". | |
| if [ "$RESPONSE" = "ok" ]; then | |
| echo "Slack notification sent successfully." | |
| else | |
| echo "Error sending Slack notification: Slack API did not return 'ok'." | |
| echo "Response from Slack: $RESPONSE" | |
| exit 1 | |
| fi |