Improving caching notebooks #183
Workflow file for this run
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: All new examples are linked in the README | |
on: | |
pull_request: | |
branches: [ main ] | |
jobs: | |
new-example-links-in-examples-readme: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get added files | |
run: | | |
git fetch origin main | |
git diff --name-status origin/main HEAD | grep ^A | cut -f2- > new_files.txt | |
echo "Added Files:" | |
cat new_files.txt | sed 's/^/ - /' | |
- name: Check for new example files | |
run: | | |
if grep "examples/" new_files.txt; then | |
grep '^examples/' new_files.txt > new_example_files.txt | |
echo "Found new file(s) in examples/:" | |
cat new_example_files.txt | sed 's/^/ - /' | |
else | |
echo "No new files found in examples/" | |
fi | |
- name: Check README links | |
run: | | |
if [[ -f new_example_files.txt ]]; then | |
all_linked=true | |
while IFS= read -r file; do | |
if ! grep -q "$file" examples/README.md; then | |
if ! grep -q "${file/examples\//](}" examples/README.md; then | |
all_linked=false | |
echo "Link to '$file' not found in README.md" | |
echo "::warning file=$file::Link to '$file' not found in examples/README.md, please add one in the table of content" | |
fi | |
fi | |
done < new_example_files.txt | |
if ! $all_linked; then | |
exit 1 | |
fi | |
fi |