-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #302 from UTDNebula/270-bug-new-courses-missing-fr…
…om-search-due-to-outdated-autocomplete-graph Auto include new courses in autocomplete graph
- Loading branch information
Showing
9 changed files
with
322 additions
and
850,850 deletions.
There are no files selected for viewing
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,80 @@ | ||
name: Update course data from API | ||
|
||
on: workflow_dispatch | ||
|
||
jobs: | ||
main: | ||
name: Fetch and rebuild autocomplete graph and combos table | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
steps: | ||
- name: Check out Git repository | ||
uses: actions/checkout@v3 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Create or reset the update branch | ||
run: | | ||
git config user.name "github-actions[bot]" | ||
git config user.email "github-actions[bot]@users.noreply.github.com" | ||
git checkout develop | ||
git branch -D update-course-data || true # Delete branch if it exists locally | ||
git checkout -b update-course-data | ||
- name: Set up Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '18' | ||
|
||
- name: Install for ts-node | ||
run: npm install | ||
|
||
- name: Add API Key | ||
run: echo "REACT_APP_NEBULA_API_KEY=${{ secrets.NEBULA_API_KEY }}" >> .env.local | ||
|
||
- name: Fetch new data from api | ||
run: npm run fetchdata | ||
|
||
- name: Build autocomplete graph | ||
run: npm run buildautocomplete | ||
|
||
- name: Build combos table | ||
run: npm run buildcombos | ||
|
||
- name: Commit changes | ||
run: | | ||
git add . | ||
git commit -m "Update course data from API" | ||
git push -f origin update-course-data | ||
- name: Create PR | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
const { repo, owner } = context.repo; | ||
const pulls = await github.rest.pulls.list({ | ||
owner: owner, | ||
repo: repo, | ||
head: 'update-course-data', | ||
base: 'develop', | ||
state: 'open', | ||
}); | ||
if (pulls.data.length < 1) { | ||
await github.rest.pulls.create({ | ||
title: 'Update course data from API', | ||
owner: owner, | ||
repo: repo, | ||
head: 'update-course-data', | ||
base: 'develop', | ||
body: [ | ||
'Fetch and rebuild autocomplete graph and combos table', | ||
'', | ||
'This PR is auto-generated by', | ||
'[actions/github-script](https://github.com/actions/github-script)', | ||
].join('\n'), | ||
}); | ||
} |
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
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.