Add trivial change to notebook #433
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: "Set up Python 3.7" | |
uses: actions/setup-python@v1 | |
with: | |
python-version: "3.7" | |
- 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: | |
CONTRIBUTION_HANDLER_API_KEY: ${{ secrets.CONTRIBUTION_HANDLER_API_KEY }} | |
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 --silent \ | |
--fail \ | |
--header 'Content-Type: application/json' \ | |
--data-raw "{\"notebook_path\": \"${notebook_path}\", \"pull_request_number\": \"${pull_request_number}\"}" \ | |
"https://contributions-api.hub.eox.at/notebook-submission-check?api_key=${CONTRIBUTION_HANDLER_API_KEY}" | |
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" | |
python ./master/.github/check_nb_metadata.py "$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" | |
python ./master/.github/check_nb_metadata.py "$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 automatic execution for all changed notebooks on the EDC cluster. The results should arrive within minutes." | |
check_for_duplicate_msg: false |