Skip to content

Commit

Permalink
Update update-courses workflow (#736)
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamin-shen authored Oct 26, 2022
1 parent 79021cf commit fc8a6c5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/update-courses.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ jobs:
cache: 'npm'
- name: NPM Clean Install
run: npm ci
- name: Generate Diff # TODO: replace this with update-courses script
run: echo "${{ github.event.inputs.semester }}" > update-courses.txt
- name: Generate Courses Json
run: npm run courses-gen
- name: Generate Requirements Json
run: npm run req-gen
- name: Check Diff
id: diff
run: exit $(git status --porcelain | wc -l)
run: if [[ $(git status --porcelain | wc -l) -gt 0 ]]; then exit 0; else exit 1; fi;
- name: Log No Diff
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
run: echo "Courses and requirements json are up to date."
Expand All @@ -31,9 +33,10 @@ jobs:
uses: peter-evans/create-pull-request@v4
with:
title: "[Automated] Update Courses (${{ github.event.inputs.semester }})"
body: "Ran `npm run courses-gen` and `npm run req-gen`, as part of the update-courses workflow."
commit-message: "[Automated] Update Courses (${{ github.event.inputs.semester }})"
committer: Cornell DTI GitHub Bot <admin@cornelldti.org>
branch: update-courses/${{ github.event.inputs.semester }}
delete-branch: true
- name: Log Pull Request URL
run: echo "Created pull request - ${{ steps.cpr.outputs.pull-request-url }}""
run: echo "Created pull request - ${{ steps.cpr.outputs.pull-request-url }}"
2 changes: 1 addition & 1 deletion src/requirements/courses-json-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ const getAllCoursesInSemester = async (
await wait(coolingTimeMs);
subjectCount += 1;
if (doPrintDebuggingInfo) {
console.log(`There're ${semesterCourses.length} courses in ${subject} in ${semester}.`);
console.log(`There are ${semesterCourses.length} courses in ${subject} in ${semester}.`);
console.log(`We fetched ${subjectCount} out of ${subjects.length} subjects in ${semester}.`);
}
}
Expand Down

0 comments on commit fc8a6c5

Please sign in to comment.