Skip to content

Almost Prime

Almost Prime #2

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