Skip to content

add a script for local testing of sending to lang api #18

add a script for local testing of sending to lang api

add a script for local testing of sending to lang api #18

name: Send RG to public data api
on: [push, workflow_dispatch]
jobs:
send-to-api:
runs-on: ubuntu-latest
permissions:
contents: read
if: ${{ github.actor != 'github-actions[bot]' && github.event_name != 'push' || github.event.pusher.name != 'github-actions[bot]' }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Determine environment
id: determine_env
run: |
if [[ ${{ github.ref }} == 'refs/heads/master' ]]; then
echo "ENV=PROD" >> $GITHUB_OUTPUT
else
echo "ENV=DEV" >> $GITHUB_OUTPUT
fi
- name: Get Secrets
uses: 1password/load-secrets-action@v2
with:
export-env: true
env:
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
API_URL: "op://DevOps/Language_API_Function_endpoints/${{ steps.determine_env.outputs.ENV }}"
TENANT: "op://DevOps/Language_API_Function_endpoints/Shared_vars/TENANT"
CLIENT_ID: "op://DevOps/Language_API_Function_endpoints/Shared_vars/CLIENT_ID"
AUTH_SECRET: "op://DevOps/Language_API_Function_endpoints/Service_auth_secrets/${{ steps.determine_env.outputs.ENV }}"
SCOPE: "op://DevOps/Language_API_Function_endpoints/Shared_vars/SCOPE"
- name: install deps
run: npm ci
- name: Send reviewers guides
uses: ./actions/sendToApi
with:
token: ${{ secrets.GITHUB_TOKEN }}
api-url: ${{ env.API_URL }}
branch: ${{ github.ref_name }}
tenant: ${{ env.TENANT }}
client-id: ${{ env.CLIENT_ID }}
auth-secret: ${{ env.AUTH_SECRET }}
api-scope: ${{ env.SCOPE }}