Skip to content

Commit

Permalink
Add extra arguments
Browse files Browse the repository at this point in the history
- Allow extra arbitrary arguments to be added to the check command
  • Loading branch information
victoriadrake committed Aug 24, 2021
1 parent 762dd0a commit 8a81987
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 Victoria Drake
Copyright (c) 2020-2021 Victoria Drake

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ env:
ENV_TYPE: venv
DEP_PATH: app/requirements.txt
APP_PATH: app/
EXTRA_ARGS: "--settings=app.settings.production"

jobs:
build:
Expand Down Expand Up @@ -109,6 +110,8 @@ Set the `APP_PATH` to the location of your `manage.py` file. For example, if you

If you are not using a virtual environment, shame on you. This action will still try to help you by installing Django. Ensure you set `APP_PATH` to the directory of your `manage.py` file.

You can use `EXTRA_ARGS` to pass any additional desired arguments, such as a settings module.

### Workflow customization

See full instructions for [Configuring and managing workflows](https://help.github.com/en/actions/configuring-and-managing-workflows).
Expand Down
7 changes: 4 additions & 3 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
FAIL=${FAIL_LEVEL:=ERROR}
MANAGE_PATH=${GITHUB_WORKSPACE}/${APP_PATH}
REQS=${GITHUB_WORKSPACE}/${DEP_PATH}
ARGS=${EXTRA_ARGS}

echo -e "Path to manage.py set as: " $MANAGE_PATH
echo -e "Requirements path set as: " $REQS
Expand All @@ -13,16 +14,16 @@ if [[ "$ENV_TYPE" == "pipenv" ]]; then
cd $REQS
pip3 install pipenv
PIPENV_IGNORE_VIRTUALENVS=1 pipenv install
cd $MANAGE_PATH && PIPENV_IGNORE_VIRTUALENVS=1 pipenv run python3 manage.py check --deploy --fail-level ${FAIL} &> output.txt
cd $MANAGE_PATH && PIPENV_IGNORE_VIRTUALENVS=1 pipenv run python3 manage.py check --deploy --fail-level ${FAIL} ${ARGS} &> output.txt
fi
if [[ "$ENV_TYPE" == "venv" ]]; then
pip install -r $REQS
cd $MANAGE_PATH && python manage.py check --deploy --fail-level ${FAIL} &> output.txt
cd $MANAGE_PATH && python manage.py check --deploy --fail-level ${FAIL} ${ARGS} &> output.txt
fi
if [[ -z "$ENV_TYPE" ]]; then
echo "No virtual environment specified."
pip install django
cd $MANAGE_PATH && python manage.py check --deploy --fail-level ${FAIL} &> output.txt
cd $MANAGE_PATH && python manage.py check --deploy --fail-level ${FAIL} ${ARGS} &> output.txt
fi

echo -e "\n--------- Django Security Check results ---------"
Expand Down

0 comments on commit 8a81987

Please sign in to comment.