diff --git a/.github/workflows/integration-deployment.yml b/.github/workflows/integration-deployment.yml index c9497c8..0088830 100644 --- a/.github/workflows/integration-deployment.yml +++ b/.github/workflows/integration-deployment.yml @@ -129,12 +129,11 @@ jobs: uses: actions/github-script@v7 with: script: | - const response = await fetch("https://run.googleapis.com/v2/projects/${{ vars.GCP_PROJECT_ID }}/locations/${{ env.API_CLOUD_RUN_LOCATION }}/services/${{ env.API_CLOUD_RUN_SERVICE }}/revisions", { headers: { 'Authorization': "Bearer ${{ steps.auth.outputs.access_token }}" } }) - .catch(err => { - console.error(err); - throw new Error(err); - }).then(res => res.json()); + const rawResponse = await fetch("https://run.googleapis.com/v2/projects/${{ vars.GCP_PROJECT_ID }}/locations/${{ env.API_CLOUD_RUN_LOCATION }}/services/${{ env.API_CLOUD_RUN_SERVICE }}/revisions", { headers: { 'Authorization': "Bearer ${{ steps.auth.outputs.access_token }}" } }); + console.log(rawResponse); + const response = await rawResponse.json(); + const toBeDeleted = response.revisions.sort((a, b) => (new Date(b.createTime) - new Date(a.createTime))).slice(1); const deletionPromises = []; for(const revision of toBeDeleted) {