Try adding new blueprint to see if CI checks work as expected #1
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: Ships Blueprint.json file? | |
on: | |
pull_request: | |
jobs: | |
check_blueprints: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Install jsonlint | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y npm | |
npm install -g jsonlint | |
- name: Find updated directories | |
id: find_directories | |
run: | | |
git diff --name-only origin/main...$GITHUB_SHA | grep '^blueprints/' | cut -d/ -f2 | sort -u > updated_directories.txt | |
- name: Check blueprint.json files | |
id: check_blueprints | |
run: | | |
while IFS= read -r directory; do | |
if [ ! -f "blueprints/$directory/blueprint.json" ]; then | |
echo "Missing blueprint.json file in $directory" | |
exit 1 | |
fi | |
done < updated_directories.txt | |
- name: Validate blueprint.json files | |
run: | | |
while IFS= read -r directory; do | |
if [ -f "blueprints/$directory/blueprint.json" ]; then | |
echo "Validating blueprint.json file in $directory" | |
jsonlint -q "blueprints/$directory/blueprint.json" | |
fi | |
done < updated_directories.txt |