Skip to content

Add script to move JACoW URLs (#60) #240

Add script to move JACoW URLs (#60)

Add script to move JACoW URLs (#60) #240

Workflow file for this run

name: lint
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
- uses: astral-sh/ruff-action@v1
with:
args: format
src: "./scripts"
- uses: astral-sh/ruff-action@v1
with:
args: check --fix
src: "./scripts"
- uses: stefanzweifel/git-auto-commit-action@v4
name: commit
with:
commit_message: Auto-format python code
- name: check all scripts follow the naming convention
run: |
dirs_with_missing_script=$(find scripts -maxdepth 1 -mindepth 1 -type d \! -exec test -f '{}'/script.py \; -print)
dirs_with_wrong_name=$(find scripts -maxdepth 1 -mindepth 1 -type d -regextype egrep \! -regex 'scripts/[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*' -print)
dirs_with_too_many_chars=$(find scripts -maxdepth 1 -mindepth 1 -type d -regextype egrep -regex 'scripts/.{41,}' -print)
if [[ $dirs_with_missing_script ]]; then
echo "::error::missing 'script.py' in ${dirs_with_missing_script//$'\n'/, }"
fi
if [[ $dirs_with_wrong_name ]]; then
echo "::error::incorrect script name in ${dirs_with_wrong_name//$'\n'/, } (must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character)"
fi
if [[ $dirs_with_too_many_chars ]]; then
echo "::error::incorrect script name in ${dirs_with_too_many_chars//$'\n'/, } (must contain at most 41 characters)"
fi
if [[ $dirs_with_missing_script ]] || [[ $dirs_with_wrong_name ]] || [[ $dirs_with_too_many_chars ]]; then
exit 1
fi