From 64b63f6833cc885b959dfd362e71e892e3cc9942 Mon Sep 17 00:00:00 2001 From: Elliot DeNolf Date: Tue, 4 Mar 2025 17:02:43 -0500 Subject: [PATCH] ci: cache mongodb image to avoid rate limiting (#11529) Adding usage of `ScribeMD/docker-cache` to cache the mongodb image. We utilize the [supercharge/mongodb-github-action](https://github.com/supercharge/mongodb-github-action) for pulling and starting our mongo image. This would at times cause `You have reached your unauthenticated pull rate limit` errors because of how many jobs our CI spins up at one time. --- .github/workflows/main.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b587046bf..d961c552f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -417,6 +417,7 @@ jobs: POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres POSTGRES_DB: payloadtests + MONGODB_VERSION: 6.0 steps: - uses: actions/checkout@v4 @@ -456,8 +457,14 @@ jobs: echo "POSTGRES_URL=postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@localhost:5432/$POSTGRES_DB" >> $GITHUB_ENV if: matrix.database == 'postgres' + # Avoid dockerhub rate-limiting + - name: Cache Docker images + uses: ScribeMD/docker-cache@0.5.0 + with: + key: docker-${{ runner.os }}-mongo-${{ env.MONGODB_VERSION }} + - name: Start MongoDB - uses: supercharge/mongodb-github-action@1.11.0 + uses: supercharge/mongodb-github-action@1.12.0 with: mongodb-version: 6.0 if: matrix.database == 'mongodb'