generated from bcgov/quickstart-openshift
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
881394e
commit eaa089b
Showing
5 changed files
with
105 additions
and
21 deletions.
There are no files selected for viewing
File renamed without changes.
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
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 8am GMT | ||
- cron: "0 8 * * *" | ||
|
||
concurrency: | ||
group: ${{ github.workflow }} | ||
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." | ||