lint-filenames
lint-filenames copied to clipboard
Unspecified error when running this action
I'm trying to use this action to validate the filenames in a folder against a regex. The run fails after 2 seconds with no clear error message.
Output of the action:
##[debug]Evaluating condition for step: 'Validate migration filenames'
##[debug]Evaluating: success()
##[debug]Evaluating success:
##[debug]=> true
##[debug]Result: true
##[debug]Starting: Validate migration filenames
##[debug]Loading inputs
##[debug]Loading env
Run batista/lint-filenames@v1
with:
path: ./db-migrations/flyway/migrations
pattern: ^[V|U|R]\d*?__[A-Za-z0-9_]*\\.sql$
====================
| Lint Filenames |
====================
ℹ️ Path: './db-migrations/flyway/migrations'
ℹ️ Pattern: /^[V|U|R]\d*?__[A-Za-z0-9_]*\\.sql$/
Error: Error: Execution failed, see log above. ❌
##[debug]Node Action run completed with exit code 1
##[debug]Finishing: Validate migration filenames
Can you see what I'm doing wrong @batista ?
Same here, did you find a solution @DonDebonair or is the repo abandoned?
I ended up creating a bash script to check filenames and run that as an action.
Script:
#!/usr/bin/env bash
badname=""
for f in "$@"
do
file=$(basename $f)
if [[ ! "$file" =~ ^([V|U|R]|afterMigrate)[0-9]*__[A-Za-z0-9_]*\.sql$ ]]; then
echo "File $file does not match"
badname=$file
fi
done
if [[ ! -z "$badname" ]]; then
exit 1
fi
Workflow:
jobs:
lint-migrations:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Validate migration filenames
shell: bash
run: db-migrations/flyway/scripts/check-migration-filenames.sh db-migrations/flyway/migrations/*
Change regex in bash script to whatever filename format you want to check against. Change directory and script location in workflow to your setup