[AddToken] kVCM to Base
#601
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: Process Token Request | |
| # Handles token addition, removal, and image optimization requests | |
| # Validates input, processes images, and creates PRs with appropriate reviewers | |
| on: | |
| issues: | |
| types: [opened] | |
| env: | |
| FIELD_NAMES: 'Network,Symbol,Name,URL,Decimals,Address,Reason' | |
| IMAGES_BASE_PATH: src/public/images/ | |
| LIST_PATH: src/public/CowSwap.json | |
| jobs: | |
| process-request: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| operation: ${{ steps.extract-info.outputs.operation }} | |
| issueInfo: ${{ steps.extract-info.outputs.issueInfo }} | |
| needsImageOptimization: ${{ steps.extract-info.outputs.needsImageOptimization }} | |
| if: contains(github.event.issue.labels.*.name, 'addImage') || contains(github.event.issue.labels.*.name, 'addToken') || contains(github.event.issue.labels.*.name, 'removeToken') | |
| steps: | |
| - name: Acknowledge request | |
| uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 | |
| with: | |
| issue-number: ${{ github.event.issue.number }} | |
| body: | | |
| 🔄 Your request has been received and is being processed. | |
| This issue will be updated when completed. | |
| - name: Checkout code | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| with: | |
| persist-credentials: false | |
| - name: Extract and validate issue information | |
| id: extract-info | |
| uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea | |
| with: | |
| script: | |
| const { processRequest } = await import("${{github.workspace}}/scripts/processRequest.mjs"); | |
| processRequest(context, core); | |
| - name: Handle validation errors | |
| if: failure() | |
| uses: peter-evans/close-issue@276d7966e389d888f011539a86c8920025ea0626 | |
| with: | |
| comment: | | |
| ❌ **Invalid request** | |
| Validation failed. Please check all required fields are provided and submit a new issue. | |
| optimize-image: | |
| needs: process-request | |
| if: needs.process-request.outputs.needsImageOptimization == 'true' | |
| uses: ./.github/workflows/optimizeImage.yml | |
| with: | |
| url: ${{ fromJSON(needs.process-request.outputs.issueInfo).url }} | |
| address: ${{ fromJSON(needs.process-request.outputs.issueInfo).address }} | |
| execute-add-token: | |
| needs: [process-request, optimize-image] | |
| if: needs.process-request.outputs.operation == 'addToken' | |
| uses: ./.github/workflows/executeAction.yml | |
| secrets: inherit | |
| with: | |
| issueInfo: ${{ needs.process-request.outputs.issueInfo }} | |
| operation: addToken | |
| prTitle: '[addToken] `${{ fromJSON(needs.process-request.outputs.issueInfo).symbol }}` to `${{ fromJSON(needs.process-request.outputs.issueInfo).network }}`' | |
| prBody: | | |
| Adding token `${{ fromJSON(needs.process-request.outputs.issueInfo).symbol }}` on network `${{ fromJSON(needs.process-request.outputs.issueInfo).network }}` | |
| **Address**: `${{ fromJSON(needs.process-request.outputs.issueInfo).address }}` | |
| [Link to block explorer ↗︎](https://${{ fromJSON(needs.process-request.outputs.issueInfo).blockExplorer }}/token/${{ fromJSON(needs.process-request.outputs.issueInfo).address }}) | |
| | Description | Image | | |
| |-|-| | |
| | Original | .url }}) | | |
| | Optimized | .prImageUrl, 'addToken') }}) | | |
| ### Reason | |
| ``` | |
| ${{ fromJSON(needs.process-request.outputs.issueInfo).reason }} | |
| ``` | |
| execute-remove-token: | |
| needs: process-request | |
| if: needs.process-request.outputs.operation == 'removeToken' | |
| uses: ./.github/workflows/executeAction.yml | |
| secrets: inherit | |
| with: | |
| issueInfo: ${{ needs.process-request.outputs.issueInfo }} | |
| operation: removeToken | |
| prTitle: '[removeToken] `${{ fromJSON(needs.process-request.outputs.issueInfo).address }}` from `${{ fromJSON(needs.process-request.outputs.issueInfo).network }}`' | |
| prBody: | | |
| Removing token from network `${{ fromJSON(needs.process-request.outputs.issueInfo).network }}` | |
| **Address**: `${{ fromJSON(needs.process-request.outputs.issueInfo).address }}` | |
| [Link to block explorer ↗︎](https://${{ fromJSON(needs.process-request.outputs.issueInfo).blockExplorer }}/token/${{ fromJSON(needs.process-request.outputs.issueInfo).address }}) | |
| ### Reason | |
| ``` | |
| ${{ fromJSON(needs.process-request.outputs.issueInfo).reason }} | |
| ``` | |
| execute-add-image: | |
| needs: [process-request, optimize-image] | |
| if: needs.process-request.outputs.operation == 'addImage' | |
| uses: ./.github/workflows/executeAction.yml | |
| secrets: inherit | |
| with: | |
| issueInfo: ${{ needs.process-request.outputs.issueInfo }} | |
| operation: addImage | |
| prTitle: '[addImage] `${{ fromJSON(needs.process-request.outputs.issueInfo).address }}` to `${{ fromJSON(needs.process-request.outputs.issueInfo).network }}`' | |
| prBody: | | |
| Adding image to network `${{ fromJSON(needs.process-request.outputs.issueInfo).network }}` | |
| **Address**: `${{ fromJSON(needs.process-request.outputs.issueInfo).address }}` | |
| [Link to block explorer ↗︎](https://${{ fromJSON(needs.process-request.outputs.issueInfo).blockExplorer }}/token/${{ fromJSON(needs.process-request.outputs.issueInfo).address }}) | |
| | Description | Image | | |
| |-|-| | |
| | Original | .url }}) | | |
| | Optimized | .prImageUrl, 'addImage') }}) | |