Skip to content

Commit

Permalink
chore: Adding ability to disable code reviews (#208)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChiefHolland authored Sep 10, 2024
1 parent 3e77852 commit 06e29a2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ There are two ways of running the `goat` locally:
GITHUB_REF=$GITHUB_REF --env GITHUB_REPOSITORY=$GITHUB_REPOSITORY --env GITHUB_ACTIONS=$GITHUB_ACTIONS -v ".:/goat/" seiso/goat:latest
```
Optional: To disable the code reviews, set `INPUT_DISABLE_CODE_REVIEW=true`
### Linter Update Considerations
1. If adding linters to `linters.json`, the `executor` is an optional member of the linter object.
Expand Down
10 changes: 9 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ function setup_environment() {
export ACTIONS_RUNNER_DEBUG="true"
fi

if [[ ${INPUT_DISABLE_CODE_REVIEW:-false} == "true" ]]; then
export DISABLE_CODE_REVIEW="true"
fi

feedback DEBUG "Looking in ${REPO_DICTIONARY} for the dictionary.txt"
feedback DEBUG "INPUT_AUTO_FIX is ${INPUT_AUTO_FIX:-not set}"
feedback DEBUG "AUTO_FIX is ${AUTO_FIX:-not set}"
Expand All @@ -125,6 +129,8 @@ function setup_environment() {
feedback DEBUG "FILTER_REGEX_EXCLUDE is ${FILTER_REGEX_EXCLUDE:-not set}"
feedback DEBUG "INPUT_LOG_LEVEL is ${INPUT_LOG_LEVEL:-not set}"
feedback DEBUG "LOG_LEVEL is ${LOG_LEVEL:-not set}"
feedback DEBUG "INPUT_DISABLE_CODE_REVIEW is ${INPUT_DISABLE_CODE_REVIEW:-not set}"
feedback DEBUG "DISABLE_CODE_REVIEW is ${DISABLE_CODE_REVIEW:-not set}"

# Sets up pyenv so that any linters ran via pipenv run can have an arbitrary python version
# More details in https://github.com/pyenv/pyenv/tree/7b713a88c40f39139e1df4ed0ceb764f73767dac#advanced-configuration
Expand Down Expand Up @@ -454,9 +460,11 @@ function rerun_lint() {
}

function initiate_code_review() {
if [[ -n ${GITHUB_ACTIONS:+x} ]]; then
if [[ -n ${GITHUB_ACTIONS:+x} && ${DISABLE_CODE_REVIEW:-false} != "true" ]]; then
# Run the Python script
python /opt/goat/bin/code_review.py
else
feedback DEBUG "Code review is disabled or not running in GitHub Actions"
fi
}

Expand Down

0 comments on commit 06e29a2

Please sign in to comment.