Remove Deleted pubcodes from the api #20
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: Remove Deleted pubcodes from the api | |
on: | |
workflow_dispatch: | |
schedule: # * is a special character in YAML, so you have to quote this string, every day at 8am GMT | |
- cron: "5 8 * * *" | |
jobs: | |
soft-delete-removed-pubcodes: | |
name: Soft Delete pubcodes In the Databse which are removed from the repo. | |
runs-on: ubuntu-22.04 | |
defaults: | |
run: | |
working-directory: utilities/remove-deleted-pubcode | |
environment: prod | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Add Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "20.x" | |
- name: Install Dependencies | |
run: npm ci | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Process script | |
run: | | |
oc login --token=${{ secrets.OC_TOKEN }} --server=${{ vars.OC_SERVER }} | |
oc project ${{ vars.OC_NAMESPACE }} | |
# Get API key | |
API_KEY=$(oc get secrets/pubcode --template={{.data.API_KEY}} | base64 -d) | |
API_URL=https://$(oc get route/pubcode-api --template={{.spec.host}}) | |
API_KEY="${API_KEY}" API_URL="${API_URL}" node index.js |