Add one Bulgarian sample #122
This file contains hidden or 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: Validate PR changes in fork | |
| on: | |
| pull_request: | |
| branches: | |
| - data | |
| jobs: | |
| check-changed-files: | |
| if: ${{ github.event.pull_request.head.repo.fork == true }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout PR code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Validate file paths | |
| id: changed | |
| shell: bash | |
| run: | | |
| git fetch origin ${{ github.base_ref }} --depth=1 | |
| CHANGED=$(git diff --name-only origin/${{ github.base_ref }} ${{ github.sha }}) | |
| echo "$CHANGED" | |
| OUTSIDE=$(echo "$CHANGED" | grep -v '^Samples/' || true) | |
| if [[ -n "$OUTSIDE" ]]; then | |
| echo "$OUTSIDE" | while read f; do | |
| echo "::error ::File modified outside Samples/: $f" | |
| done | |
| status=1 | |
| fi | |
| DIRS=$(echo "$CHANGED" \ | |
| | sed -n 's|^Samples/\([^/]*\)/.*|\1|p' \ | |
| | sort -u) | |
| COUNT=$(echo "$DIRS" | wc -l) | |
| if (( COUNT > 1 )); then | |
| echo "::error Title=Multiple PressMint-?? folders inside Samples/ were modified::" $(echo $DIRS|tr "\n" " ") | |
| status=1 | |
| fi | |
| for d in $DIRS; do | |
| echo "Validating folder: $d" | |
| BASE="Samples/$d" | |
| while IFS= read -r entry; do | |
| name=$(basename "$entry") | |
| # Skip allowed files/dirs | |
| if [[ "$name" == "${d}.xml" ]] \ | |
| || [[ "$name" == "${d}.ana.xml" ]] \ | |
| || [[ "$name" == "Sources" ]] \ | |
| || [[ "$name" == "README.md" ]] ; then | |
| continue | |
| elif [[ $name =~ ^pressmint[0-9]*_[-a-z]*\.regi$ ]] ; then | |
| continue | |
| elif [[ $name =~ ^PressMint-.*taxonomy.*\.xml$ ]] ; then | |
| continue | |
| elif [[ $name =~ ^[0-9]{4}$ ]] ; then | |
| if [[ -d "${entry}" ]]; then | |
| NESTED_DIRS=$(find "$entry" -mindepth 1 -type d) | |
| if [[ -n "$NESTED_DIRS" ]]; then | |
| while IFS= read -r nd; do | |
| echo "::error ::Nested directory found inside $entry: $nd" | |
| done <<< "$NESTED_DIRS" | |
| status=1 | |
| else | |
| continue | |
| fi | |
| fi | |
| fi | |
| # Anything else is unexpected | |
| echo "::error ::Unexpected entry in $BASE: $entry" | |
| status=1 | |
| done < <(find "$BASE" -mindepth 1 -maxdepth 1) | |
| done | |
| exit $status |