Skip to content

Schedule Jobs

Schedule Jobs #623

Workflow file for this run

name: Schedule Jobs
on:
workflow_dispatch:
inputs:
REPO_NAMES:
required: false
description: comma separated list of repo names within bcgov org. for one of jobs to run for specific repos.
schedule: # * is a special character in YAML, so you have to quote this string, every day at 4PM PST as 5PM the powerbi refresh happens.
- cron: "0 0 * * *"
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
jobs:
pubcode-crawler:
name: Crawl Git Repos for bcgovpubcode.yml
runs-on: ubuntu-24.04
environment: prod
defaults:
run:
working-directory: crawler
steps:
- name: Check out repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
- name: Add Node.js
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5
with:
node-version: "22.x"
- name: Install Dependencies
run: npm ci
- uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- uses: redhat-actions/openshift-tools-installer@144527c7d98999f2652264c048c7a9bd103f8a82 # v1
with:
oc: "4"
- name: Process script
env:
GIT_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO_NAMES: ${{ github.event.inputs.REPO_NAMES }}
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 src/main.js
validate-ministry-list:
name: Validate Ministry List in the pubcode schema.
runs-on: ubuntu-24.04
defaults:
run:
working-directory: schema/script
steps:
- name: Check out repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
- name: Add Node.js
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5
with:
node-version: "22.x"
- name: Install Dependencies
run: npm ci
- uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Process script
id: validate-ministry-list
run: node ./index.js
- name: create a branch, commit and push changes
if: steps.validate-ministry-list.outputs.schemaChanged == 'true'
env:
GH_TOKEN: ${{ github.token }}
run: |
git config --local user.name ${{ github.actor }}
git checkout -b chore/ministry-name-schema
git add ../bcgovpubcode.json
git commit -m "Updating the Schema as changes to ministry names were detected."
git push origin chore/ministry-name-schema
# Create a Pull Request
gh pr create --assignee "mishraomp" --base main --label "chore" --title "Updating the Schema as changes to ministry names were detected." --body "Updating the Schema as changes to ministry names were detected."
soft-delete-removed-pubcodes:
name: Soft Delete pubcodes In the Databse which are removed from the repo.
runs-on: ubuntu-24.04
defaults:
run:
working-directory: utilities/remove-deleted-pubcode
environment: prod
steps:
- name: Check out repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
- name: Add Node.js
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5
with:
node-version: "22.x"
- name: Install Dependencies
run: npm ci
- uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- uses: redhat-actions/openshift-tools-installer@144527c7d98999f2652264c048c7a9bd103f8a82 # v1
with:
oc: "4"
- 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