APIs Guru Ratings #357
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: APIs Guru Ratings | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: 0 0 * * * | |
jobs: | |
generate: | |
name: Update API Ratings | |
runs-on: ubuntu-latest | |
permissions: | |
contents: "read" | |
id-token: "write" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: ".nvmrc" | |
cache: "npm" | |
- run: npm ci | |
- run: npm run build | |
# Do this right before the script as the checkout takes a bit of time | |
# and we dont want the token to expire before we use it. | |
- name: "Authenticate to Google Cloud" | |
uses: "google-github-actions/auth@v1" | |
with: | |
token_format: "access_token" | |
workload_identity_provider: projects/196494084534/locations/global/workloadIdentityPools/github-actions-wi-pool/providers/github-actions-wi-provider | |
service_account: "[email protected]" | |
access_token_lifetime: 3600 | |
- run: node apis-guru.mjs | |
working-directory: apps/api | |
timeout-minutes: 30 | |
env: | |
GOOGLE_CLOUD_STORAGE_BUCKET: rate-my-open-api-prod | |
GOOGLE_CLOUD_PROJECT_ID: zuplo-marketing | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
RUN_ID: ${{github.run_id}} | |
- run: node apis-guru.ratings.mjs | |
working-directory: apps/api | |
if: always() | |
env: | |
RUN_ID: ${{github.run_id}} | |
- uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: logs | |
path: apis-guru | |
# Reauthenticate to Google Cloud because its possible this job takes | |
# more than 1 hour to run and we want to make sure we save any updates | |
- name: "Authenticate to Google Cloud" | |
uses: "google-github-actions/auth@v1" | |
if: always() | |
with: | |
token_format: "access_token" | |
workload_identity_provider: projects/196494084534/locations/global/workloadIdentityPools/github-actions-wi-pool/providers/github-actions-wi-provider | |
service_account: "[email protected]" | |
access_token_lifetime: 3600 | |
- name: Upload Ratings | |
if: always() | |
uses: "google-github-actions/upload-cloud-storage@v1" | |
with: | |
path: apis-guru | |
destination: rate-my-openapi-public/apis-guru | |
parent: false | |
headers: |- | |
content-type: application/json | |
cache-control: no-cache |