Add trivial change to notebook #449
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
name: "Check notebook submission" | |
on: [pull_request] | |
jobs: | |
check_submission: | |
name: "Check submission" | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Checkout pull request" | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 2 # need fetch depth to get commit message | |
- name: "Retrieve last commit message" | |
id: commitmsg | |
run: echo "::set-output name=commitmsg::$(git log --no-merges -1 --oneline)" | |
- name: "Checkout master" | |
# check out master to the directory master to execute scripts and possibly for comparison | |
uses: actions/checkout@v2 | |
with: | |
ref: "master" | |
path: "master" | |
- name: "Find changed files" | |
id: file_changes | |
uses: trilom/file-changes-action@v1 | |
with: | |
githubToken: ${{ secrets.GITHUB_TOKEN }} | |
- name: "Check submissions" | |
if: "!contains(steps.commitmsg.outputs.commitmsg, 'skip ci')" | |
env: | |
HUB_PYGEOAPI_AUTH_TOKEN: ${{ secrets.HUB_PYGEOAPI_AUTH_TOKEN }} | |
run: | | |
set -e | |
pull_request_number=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH") | |
function trigger_execution() { | |
notebook_path=$1 | |
echo "Triggering execution of ${notebook_path}" | |
curl -X POST \ | |
--fail \ | |
-v \ | |
"https://hub.eox.at/services/eoxhub-gateway/eurodatacube0/pygeoapi/processes/execute-notebook/execution" \ | |
--header 'Content-Type: application/json' \ | |
-H "Authorization: Token ${HUB_PYGEOAPI_AUTH_TOKEN}" \ | |
--data-raw '{"inputs": { | |
"notebook": "extra/notebook-verification/execute-eurodatacube-from-PR.ipynb", | |
"cpu_requests": "0.3", | |
"cpu_limit": "0.3", | |
"mem_requests": "1G", | |
"mem_limit": "1G", | |
"kernel": "python3", | |
"parameters_json": {"pull_request_number": '"${pull_request_number}"', "notebook_path_in_repo": "'"${notebook_path}"'"} | |
}}' | |
if [ $? -ne 0 ] ; then | |
echo "Notebook execution trigger failed" | |
exit 1 | |
fi | |
} | |
for new_file in $(jq --raw-output ".[]" $HOME/files_added.json); do | |
echo "Checking newfile: $new_file" | |
trigger_execution "$new_file" | |
done | |
for mod_file in $(jq --raw-output ".[]" $HOME/files_modified.json); do | |
echo "Checking modified file: $mod_file" | |
trigger_execution "$mod_file" | |
done | |
- name: "Comment PR" | |
if: "!contains(steps.commitmsg.outputs.commitmsg, 'skip ci')" | |
uses: unsplash/comment-on-pr@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
msg: "I have scheduled an automatic execution for all changed notebooks on EOxHub. The results should arrive within minutes." | |
check_for_duplicate_msg: false |