chore: add in memory cache to NetworkService #30
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: Publish a preview build | |
| on: | |
| issue_comment: | |
| types: created | |
| jobs: | |
| is-fork-pull-request: | |
| name: Determine whether this issue comment was on a pull request from a fork | |
| if: ${{ github.event.issue.pull_request && startsWith(github.event.comment.body, '@metamaskbot publish-preview') }} | |
| runs-on: ubuntu-latest | |
| outputs: | |
| IS_FORK: ${{ steps.is-fork.outputs.IS_FORK }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Determine whether this PR is from a fork | |
| id: is-fork | |
| run: echo "IS_FORK=$(gh pr view --json isCrossRepository --jq '.isCrossRepository' "${PR_NUMBER}" )" >> "$GITHUB_OUTPUT" | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| PR_NUMBER: ${{ github.event.issue.number }} | |
| publish-preview: | |
| name: Publish build preview | |
| needs: is-fork-pull-request | |
| permissions: | |
| pull-requests: write | |
| # This ensures we don't publish on forks. We can't trust forks with this token. | |
| if: ${{ needs.is-fork-pull-request.outputs.IS_FORK == 'false' }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Check out pull request | |
| run: gh pr checkout "${PR_NUMBER}" | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| PR_NUMBER: ${{ github.event.issue.number }} | |
| - name: Checkout and setup environment | |
| uses: MetaMask/action-checkout-and-setup@v2 | |
| with: | |
| is-high-risk-environment: true | |
| - name: Build | |
| run: yarn build:prod | |
| env: | |
| ENVIRONMENT: production | |
| LOG_LEVEL: all | |
| RPC_URL_MAINNET: ${{ secrets.RPC_URL_MAINNET }} | |
| HORIZON_URL_MAINNET: ${{ secrets.HORIZON_URL_MAINNET }} | |
| EXPLORER_MAINNET_BASE_URL: ${{ secrets.EXPLORER_MAINNET_BASE_URL }} | |
| RPC_URL_TESTNET: ${{ secrets.RPC_URL_TESTNET }} | |
| HORIZON_URL_TESTNET: ${{ secrets.HORIZON_URL_TESTNET }} | |
| EXPLORER_TESTNET_BASE_URL: ${{ secrets.EXPLORER_TESTNET_BASE_URL }} | |
| TOKEN_API_BASE_URL: ${{ secrets.TOKEN_API_BASE_URL }} | |
| STATIC_API_BASE_URL: ${{ secrets.STATIC_API_BASE_URL }} | |
| PRICE_API_BASE_URL: ${{ secrets.PRICE_API_BASE_URL }} | |
| - name: Get commit SHA | |
| id: commit-sha | |
| run: echo "COMMIT_SHA=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT" | |
| - name: Prepare preview builds | |
| run: yarn prepare-preview-builds @metamask-previews ${{ steps.commit-sha.outputs.COMMIT_SHA }} | |
| - name: Publish preview build | |
| run: yarn publish-previews | |
| env: | |
| YARN_NPM_AUTH_TOKEN: ${{ secrets.PUBLISH_PREVIEW_NPM_TOKEN }} | |
| - name: Generate preview build message | |
| run: yarn tsx scripts/generate-preview-build-message.ts | |
| - name: Post build preview in comment | |
| run: gh pr comment "${PR_NUMBER}" --body-file preview-build-message.txt | |
| env: | |
| COMMIT_SHA: ${{ steps.commit-sha.outputs.COMMIT_SHA }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| PR_NUMBER: ${{ github.event.issue.number }} |