diff --git a/.github/workflows/remove-deleted-repos.yaml b/.github/workflows/remove-deleted-repos.yaml deleted file mode 100644 index 0a0605f..0000000 --- a/.github/workflows/remove-deleted-repos.yaml +++ /dev/null @@ -1,42 +0,0 @@ -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@v4 - 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 diff --git a/.github/workflows/schedule-jobs.yml b/.github/workflows/schedule-jobs.yml deleted file mode 100644 index de2aa63..0000000 --- a/.github/workflows/schedule-jobs.yml +++ /dev/null @@ -1,96 +0,0 @@ -name: Scheduled - -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 8am GMT - - cron: "0 8 * * *" - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - pubcode-crawler: - name: Crawl Git Repos for bcgovpubcode.yml - runs-on: ubuntu-22.04 - environment: prod - defaults: - run: - working-directory: crawler - steps: - - name: Check out repository - uses: actions/checkout@v4 - - - name: Add Node.js - uses: actions/setup-node@v4 - 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 - 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-22.04 - defaults: - run: - working-directory: schema/script - steps: - - name: Check out repository - uses: actions/checkout@v4 - - - name: Add Node.js - uses: actions/setup-node@v4 - 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 - 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." - diff --git a/.github/workflows/scheduled.yml b/.github/workflows/scheduled.yml index e20643b..ec4362b 100644 --- a/.github/workflows/scheduled.yml +++ b/.github/workflows/scheduled.yml @@ -94,3 +94,37 @@ jobs: # 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-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@v4 + 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