Skip to content

External API check #751

External API check

External API check #751

# This workflow will check if no regression is introduced in externals API
name: 'External API check'
on:
workflow_dispatch:
# Check twice a day at 5:00 AM and 3:00 PM
schedule:
- cron: '0 5,15 * * *'
# Be extremely careful as the env variables defined here are accessible by all the actions of the workflow.
# For critical env variable, declare it within the action.
env:
node-version: 18.x
INSEE_CLIENT_ID: ${{ secrets.INSEE_CLIENT_ID }}
INSEE_CLIENT_SECRET: ${{ secrets.INSEE_CLIENT_SECRET}}
INSEE_CLIENT_ID_FALLBACK: ${{ secrets.INSEE_CLIENT_ID_FALLBACK }}
INSEE_CLIENT_SECRET_FALLBACK: ${{ secrets.INSEE_CLIENT_SECRET_FALLBACK}}
NEXT_PUBLIC_END2END_MOCKING: disabled
INDEXING_ENABLED: enabled
REDIS_ENABLED: disabled
PROXY_API_KEY: ${{ secrets.PROXY_API_KEY }}
IRON_SESSION_PWD: ${{ secrets.IRON_SESSION_PWD }}
jobs:
dependencies:
name: 'Install dependencies'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ env.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.node-version }}
- uses: ./.github/actions/install-dependencies
name: Install and cache dependencies
testExternalAPIs:
name: Test externals API
runs-on: ubuntu-latest
needs: [dependencies]
permissions:
contents: write
pull-requests: write
repository-projects: write
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ env.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.node-version }}
- name: Load node_modules
uses: ./.github/actions/load-dependencies
- name: Run API client unit tests
run: |
npm run test:api-clients:update-snapshots -- --runInBand --testTimeout=61000 --silent
- name: 'Create a PR if there is a diff in the snapshots'
uses: peter-evans/create-pull-request@v6
env:
GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB_EXTERNAL_API_TEST_PR }}
with:
branch: 'BOT-snapshots-update'
title: '🤖 API client snapshots update'
commit-message: 'test: update API clients snapshots'
body: |
*This PR is automatically generated by a bot.*
It updates the snapshots of the API clients.
Review carefully the changes to see if there is no regression:
- No changes in attributes names
- No suspect massive changes in the data
- No changes in the structure of the data
If everything looks good, you can merge this PR.
Otherwise, you should take action to fix the issue, by either:
- Contact the administration responsible for the API
- Change the client code to adapt to the new data