Skip to content

job params

job params #40

name: Verify and Define RPC Endpoints
on: [push] # Trigger the workflow on push
jobs:
check_rpc_endpoints:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- network: 'sepolia'
l1_rpc_url: "https://ci-sepolia-l1.optimism.io"
l2_rpc_url: "https://sepolia.optimism.io"
- network: 'goerli'
l1_rpc_url: "https://ci-goerli-l1.optimism.io"
l2_rpc_url: "https://goerli.optimism.io"
- network: 'mainnet'
l1_rpc_url: "https://ci-mainnet-l1.optimism.io"
l2_rpc_url: "https://mainnet.optimism.io"
outputs:
l1_rpc_url: ${{ steps.check_endpoints.outputs.l1_rpc_url }}
l2_rpc_url: ${{ steps.check_endpoints.outputs.l2_rpc_url }}
steps:
- uses: actions/checkout@v2
- name: Check RPC Endpoints
id: check_endpoints
run: |
export TIME_DIFF_THRESHOLD="30"
if ops/verify-geth-endpoint.sh "${{ matrix.l1_rpc_url }}" $TIME_DIFF_THRESHOLD; then
if ops/verify-geth-endpoint.sh "${{ matrix.l2_rpc_url }}" $TIME_DIFF_THRESHOLD; then
echo "Both RPC endpoints are up to date and not syncing."
echo "l1_rpc_url=${{ matrix.l1_rpc_url }}" >> $GITHUB_OUTPUT
echo "l2_rpc_url=${{ matrix.l2_rpc_url }}" >> $GITHUB_OUTPUT
else
echo "L2 RPC endpoint for ${{ matrix.network }} failed the checks."
exit 1
fi
else
echo "L1 RPC endpoint for ${{ matrix.network }} failed the checks."
exit 1
fi
example_mainnet_job:
needs: check_rpc_endpoints
runs-on: ubuntu-latest
steps:
- name: Use RPC URLs
run: |
L1_RPC_URL=${{ needs.check_rpc_endpoints.outputs.l1_rpc_url }}
L2_RPC_URL=${{ needs.check_rpc_endpoints.outputs.l2_rpc_url }}
echo "L1 RPC URL: $L1_RPC_URL"
echo "L2 RPC URL: $L2_RPC_URL"
# Use L1_RPC_URL and L2_RPC_URL here.