Skip to content

Commit

Permalink
fix: ignore lib/bashunit on editorconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
Chemaclass committed Aug 27, 2024
1 parent 0fc78ef commit abdcad1
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 9 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ indent_style = tab

[{lib/*,README.md}]
indent_size = unset

[{lib/bashunit}]
indent_size = unset
6 changes: 3 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
DEFAULT_PATH=tests
PR_TICKET_LINK_PREFIX=https://your-company.atlassian.net/browse/
PR_TEMPLATE_DIR=.github/PULL_REQUEST_TEMPLATE.md
DEFAULT_PATH=
PR_TICKET_LINK_PREFIX=
PR_TEMPLATE_DIR=
13 changes: 13 additions & 0 deletions bin/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
echo "Running pre-commit checks"

make pre_commit/run
EXIT_CODE=$?

if [[ ${EXIT_CODE} -ne 0 ]]; then
echo "Pre Commit checks failed. Please fix the above issues before committing"
exit ${EXIT_CODE}
else
echo "Pre Commit checks passed, no problems found"
exit 0
fi
10 changes: 4 additions & 6 deletions create-pr.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
#!/bin/bash

# shellcheck disable=SC2034

ROOT_DIR="$(dirname "${BASH_SOURCE[0]}")"

# shellcheck disable=SC1091
[[ -f .env ]] && source .env

source "$ROOT_DIR/src/pr_format.sh"
source "$ROOT_DIR/src/generic.sh"

[ -f "$ROOT_DIR/src/dev/debug.sh" ] && source "$ROOT_DIR/src/dev/debug.sh"
source "$ROOT_DIR/src/dev/debug.sh"

# Template Configuration
APP_ROOT_DIR=$(git rev-parse --show-toplevel) || error_and_exit "This directory is not a git repository"
Expand All @@ -18,7 +16,6 @@ PR_TEMPLATE="$APP_ROOT_DIR/$PR_TEMPLATE_DIR"
[ -z "$PR_TEMPLATE" ] && error_and_exit "PR template file $PR_TEMPLATE not found."

BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD 2>/dev/null) || error_and_exit "Failed to get the current branch name."
GH_CLI_INSTALLATION_URL="https://cli.github.com/"
BASE_BRANCH=${BASE_BRANCH:-"main"}
ASSIGNEE=${ASSIGNEE:-"@me"}

Expand All @@ -34,7 +31,8 @@ validate_base_branch_exists

# Push the current branch
if ! git push -u origin "$BRANCH_NAME"; then
error_and_exit "Failed to push the current branch to the remote repository. Please check your git remote settings."
error_and_exit "Failed to push the current branch to the remote repository."\
"Please check your git remote settings."
fi

# Create the PR with the specified options
Expand Down
2 changes: 2 additions & 0 deletions src/generic.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

GH_CLI_INSTALLATION_URL="https://cli.github.com/"

function error_and_exit() {
echo "Error: $1" >&2
exit 1
Expand Down

0 comments on commit abdcad1

Please sign in to comment.