Path: blob/main/scripts/content_checks/missing_nb_check.sh
3855 views
#!/usr/bin/env bash12# this script creates a `notebooks.txt` containing list of notebooks that3# are present in qiskit-community/qiskit-textbook but are not in4# Qiskit/platypus.5#6# this script is run from the `Check for Textbook notebooks` GitHub action7# which should contain a copy of the qiskit-textbook and platypus repos8910# diff the notebooks directory of the two repos and add all notebooks found11# in qiskit-textbook but not found in platypus into a `notebooks.txt` file12diff -aqr platypus/notebooks qiskit-textbook/content | sort | grep 'Only in qiskit-textbook' | grep -E '\.ipynb$' > notebooks.txt1314# count the number of lines (notebooks found) in qiskit-textbook but not in15# platypus16NUM_NB=$(cat notebooks.txt | wc -l)1718echo 'found $NUM_NB new notebooks'1920# set GitHub action variable to be checked by next step/task to determine21# if an issue should be created22echo '::set-output name=NUM_NB::$NUM_NB'2324# replace all newline characters with `\n` so the list used in a JSON object25NB_LIST=$(sed -e :a -e '$!N;s/\n/\\n/;ta' notebooks.txt)2627# create the JSON that will be used as payload for the create issue REST API28echo '{' > issue.txt29echo ' "title": "Missing notebooks",' >> issue.txt30echo ' "labels": ["bug"],' >> issue.txt31echo ' "assignees": ["vabarbosa", "frankharkins"],' >> issue.txt32echo ' "body": "'$NB_LIST'"' >> issue.txt33echo '}' >> issue.txt3435exit 0363738