Update cache #2876
This file contains 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: Update cache | |
# This action checks if there's new finished proposals every 3h | |
# If new finished proposal data is found the cache will be warmed up & push | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | |
cancel-in-progress: true | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: 0 */3 * * * | |
jobs: | |
cache-updates: | |
strategy: | |
matrix: | |
# Only mainnet for now | |
network: [mainnet] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version-file: '.nvmrc' | |
cache: 'yarn' | |
- name: Packages install | |
shell: sh | |
run: yarn --frozen-lockfile --prefer-offline | |
- name: Update cache | |
shell: sh | |
run: yarn cache:update | |
env: | |
CORE_NETWORK: ${{ matrix.network }} | |
RPC_POLYGON: ${{ secrets.RPC_POLYGON }} | |
RPC_OPTIMISM: ${{ secrets.RPC_OPTIMISM }} | |
RPC_MAINNET: ${{ secrets.RPC_MAINNET }} | |
RPC_BASE: ${{ secrets.RPC_BASE }} | |
RPC_ARBITRUM: ${{ secrets.RPC_ARBITRUM }} | |
RPC_ZKEVM: ${{ secrets.RPC_ZKEVM }} | |
RPC_ZKSYNC: ${{ secrets.RPC_ZKSYNC }} | |
IPFS_GATEWAY: ${{ secrets.IPFS_GATEWAY }} | |
- name: Parse cache to separate files | |
shell: sh | |
run: yarn cache:parse | |
env: | |
CORE_NETWORK: ${{ matrix.network }} | |
RPC_POLYGON: ${{ secrets.RPC_POLYGON }} | |
RPC_OPTIMISM: ${{ secrets.RPC_OPTIMISM }} | |
RPC_MAINNET: ${{ secrets.RPC_MAINNET }} | |
RPC_BASE: ${{ secrets.RPC_BASE }} | |
RPC_ARBITRUM: ${{ secrets.RPC_ARBITRUM }} | |
RPC_ZKEVM: ${{ secrets.RPC_ZKEVM }} | |
RPC_ZKSYNC: ${{ secrets.RPC_ZKSYNC }} | |
IPFS_GATEWAY: ${{ secrets.IPFS_GATEWAY }} | |
- name: Check code diff and push | |
run: | | |
if [[ -z $(git status -s) ]] | |
then | |
echo "tree is clean" | |
else | |
git config --global user.name 'Cache update' | |
git config --global user.email 'cache-bot@bgd.com' | |
git pull | |
git add . | |
git commit -am "chore: automated cache update" | |
git push | |
exit | |
fi |