diff --git a/.github/workflows/test_changed_notebooks.yml b/.github/workflows/test_changed_notebooks.yml index 05fc7d1..39566e5 100644 --- a/.github/workflows/test_changed_notebooks.yml +++ b/.github/workflows/test_changed_notebooks.yml @@ -1,7 +1,7 @@ name: Execute Jupyter Notebooks With Changes on: - workflow_dispatch: + workflow_dispatch: pull_request: branches: - main @@ -18,38 +18,39 @@ jobs: password: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }} steps: - - name: Checkout repository - uses: actions/checkout@v4 + - name: Checkout repository + uses: actions/checkout@v4 - - name: Get changed files - id: changed-files-git - run: | - cd ${GITHUB_WORKSPACE} - ls -a - chown -R root . - git status || true - # Captures changed Jupyter notebooks between the last commit and the previous one - CHANGED_NOTEBOOKS=$(git diff --name-only HEAD^ || true) - echo "changed_files=${CHANGED_NOTEBOOKS}" >> $GITHUB_OUTPUT + - name: Get changed files + id: changed-files-git + run: | + cd ${GITHUB_WORKSPACE} + ls -a + chown -R root . + git status || true + # Captures changed Jupyter notebooks between the last commit and the + # previous one + CHANGED_NOTEBOOKS=$(git diff --name-only HEAD^ || true) + echo "changed_files=${CHANGED_NOTEBOOKS}" >> $GITHUB_OUTPUT - - name: Execute changed notebooks - if: steps.changed-files-git.outputs.changed_files - run: | - echo "Changed Notebooks: ${CHANGED_NOTEBOOKS}" - for file in $CHANGED_NOTEBOOKS; do - if [[ $file == *.ipynb ]]; then - echo "Executing notebook: $file" - jupyter nbconvert --to notebook --execute --inplace "$file" || echo "FAILED: ${file}" - fi - done + - name: Execute changed notebooks + if: steps.changed-files-git.outputs.changed_files + run: | + echo "Changed Notebooks: ${CHANGED_NOTEBOOKS}" + for file in $CHANGED_NOTEBOOKS; do + if [[ $file == *.ipynb ]]; then + echo "Executing notebook: $file" + jupyter nbconvert --to notebook --execute --inplace "$file" || echo "FAILED: ${file}" + fi + done - - name: Check for errors - run: | - for file in $CHANGED_NOTEBOOKS; do - if [[ $file == *.ipynb && -f "$file" ]]; then - if grep -q "Execution failed" "$file"; then - echo "Notebook execution failed: $file" - exit 1 + - name: Check for errors + run: | + for file in $CHANGED_NOTEBOOKS; do + if [[ $file == *.ipynb && -f "$file" ]]; then + if grep -q "Execution failed" "$file"; then + echo "Notebook execution failed: $file" + exit 1 + fi fi - fi - done + done diff --git a/.github/workflows/test_notebooks.yml b/.github/workflows/test_notebooks.yml index 7c2516b..769c12a 100644 --- a/.github/workflows/test_notebooks.yml +++ b/.github/workflows/test_notebooks.yml @@ -1,7 +1,7 @@ name: Test Jupyter Notebooks on: - workflow_dispatch: + workflow_dispatch: push: branches: - main @@ -19,72 +19,71 @@ jobs: password: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }} steps: - - name: Checkout repository - uses: actions/checkout@v4 + - name: Checkout repository + uses: actions/checkout@v4 - #- name: Get changed notebooks - # id: changed-notebooks - # uses: tj-actions/changed-files@v44 - # with: - # since_last_remote_commit: true - # files: | - # **.ipynb + #- name: Get changed notebooks + # id: changed-notebooks + # uses: tj-actions/changed-files@v44 + # with: + # since_last_remote_commit: true + # files: | + # **.ipynb - - name: Set WORKSPACE_DIR - id: set-variables - run: | - echo GITHUB_WORKSPACE: $GITHUB_WORKSPACE - ls -a ${GITHUB_WORKSPACE} + - name: Set WORKSPACE_DIR + id: set-variables + run: | + echo GITHUB_WORKSPACE: $GITHUB_WORKSPACE + ls -a ${GITHUB_WORKSPACE} - REPO_FULL_NAME="${{ github.repository }}" - echo REPO_FULL_NAME="${REPO_FULL_NAME}" - REPO_NAME="${REPO_FULL_NAME#*/}" - echo REPO_NAME="${REPO_NAME}" - WORKSPACE_DIR="/__w/${REPO_NAME}/${REPO_NAME}" - echo "WORKSPACE_DIR=${WORKSPACE_DIR}" >> $GITHUB_ENV + REPO_FULL_NAME="${{ github.repository }}" + echo REPO_FULL_NAME="${REPO_FULL_NAME}" + REPO_NAME="${REPO_FULL_NAME#*/}" + echo REPO_NAME="${REPO_NAME}" + WORKSPACE_DIR="/__w/${REPO_NAME}/${REPO_NAME}" + echo "WORKSPACE_DIR=${WORKSPACE_DIR}" >> $GITHUB_ENV - ls -a ${WORKSPACE_DIR} + ls -a ${WORKSPACE_DIR} - - name: Add debugging - run: | - echo "pwd: " `pwd` - echo ============================ - echo "ls -a" - ls -a - echo ============================ - echo "ls -a ${WORKSPACE_DIR}" - ls -a ${WORKSPACE_DIR} - echo ============================ + - name: Add debugging + run: | + echo "pwd: " `pwd` + echo ============================ + echo "ls -a" + ls -a + echo ============================ + echo "ls -a ${WORKSPACE_DIR}" + ls -a ${WORKSPACE_DIR} + echo ============================ - - name: Execute notebooks - shell: bash - run: | - ls -a - for file in test_notebooks/* ; do - echo "Converting: '${file}'" - if [ ! -f "${file}" ]; then continue ; fi - jupyter nbconvert --to notebook --execute --inplace "$file" || echo FAILED: "${file}" - done + - name: Execute notebooks + shell: bash + run: | + ls -a + for file in test_notebooks/* ; do + echo "Converting: '${file}'" + if [ ! -f "${file}" ]; then continue ; fi + jupyter nbconvert --to notebook --execute --inplace "$file" || echo FAILED: "${file}" + done - - name: Check for errors - shell: bash - run: | - cd $WORKSPACE_DIR - for file in test_notebooks/* ; do - if [ ! -f "${file}" ]; then continue ; fi - if grep -q "Execution failed" "$file"; then - echo "Notebook execution failed: $file" - #exit 1 - fi - done + - name: Check for errors + shell: bash + run: | + cd $WORKSPACE_DIR + for file in test_notebooks/* ; do + if [ ! -f "${file}" ]; then continue ; fi + if grep -q "Execution failed" "$file"; then + echo "Notebook execution failed: $file" + #exit 1 + fi + done - - name: Get changed files - id: changed-files-git - run: | - cd ${GITHUB_WORKSPACE} - ls -a - git status || true - - CHANGED_NOTEBOOKS=$(git diff --name-only HEAD^ || true) - echo "changed_files=${CHANGED_NOTEBOOKS}" >> $GITHUB_OUTPUT + - name: Get changed files + id: changed-files-git + run: | + cd ${GITHUB_WORKSPACE} + ls -a + git status || true + CHANGED_NOTEBOOKS=$(git diff --name-only HEAD^ || true) + echo "changed_files=${CHANGED_NOTEBOOKS}" >> $GITHUB_OUTPUT diff --git a/.yamllint.yaml b/.yamllint.yaml new file mode 100644 index 0000000..1511315 --- /dev/null +++ b/.yamllint.yaml @@ -0,0 +1,46 @@ +# This config represents running the command `yamllint -d relaxed .` with the +# following extra rules: +# +# new-line-at-end-of-file: +# level: warning +# trailing-spaces: +# level: warning +# +# We also ignore the cookiecutter directories as these often contain +# jinja-style templating functions that yamllint doesn't play nicely with +# +# cribbed from https://github.com/2i2c-org/infrastructure/blob/main/.yamllint.yaml +--- +extends: default + +ignore: | + **/template/** + **/templates/** + +rules: + braces: + level: warning + max-spaces-inside: 1 + brackets: + level: warning + max-spaces-inside: 1 + colons: + level: warning + commas: + level: warning + comments: disable + comments-indentation: disable + document-start: disable + empty-lines: + level: warning + hyphens: + level: warning + indentation: + level: warning + indent-sequences: consistent + line-length: disable + new-line-at-end-of-file: + level: warning + trailing-spaces: + level: warning + truthy: disable diff --git a/scripts/query_courseid.py b/scripts/query_courseid.py index 041060a..b180ecf 100755 --- a/scripts/query_courseid.py +++ b/scripts/query_courseid.py @@ -80,7 +80,7 @@ def getCourseInformation(term_id, class_name, page_number=1, page_size=100): headersinput = { "app_id": "13eb564e", - "app_key": "74e1f260b527e7655628220a5de615c6", + "app_key": "", } response = requests.get(full_url, headers = headersinput) @@ -106,7 +106,7 @@ def getCourseInformation(term_id, class_name, page_number=1, page_size=100): headersinput = { "app_id": "13eb564e", - "app_key": " ", + "app_key": "", } response = requests.get(full_url, headers = headersinput) @@ -147,4 +147,4 @@ def getCourseInformation(term_id, class_name, page_number=1, page_size=100): # STAT C131A has an A at the end #get instructor name -# add instructor name to the json output \ No newline at end of file +# add instructor name to the json output