Almost Prime #2
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 File name on Pull Request | |
on: | |
pull_request: | |
branches: | |
- master | |
jobs: | |
checkFileName: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Check File Names | |
run: | | |
CHANGED_FILES=$(git diff --name-only HEAD~1 HEAD) | |
echo "$CHANGED_FILES" | |
for file in $CHANGED_FILES; do | |
if [[ ! ($file =~ ^[0-9]+[A-Z]\.(cpp|py)$) ]]; then | |
echo "Error: File '$file' does not match allowed pattern" | |
exit 1 | |
fi | |
done |