-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: pre-commit hooks and apply comments on #8
- Loading branch information
Showing
4 changed files
with
57 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
on: | ||
pull_request: | ||
push: | ||
|
||
jobs: | ||
main: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.x | ||
- uses: pre-commit/[email protected] | ||
- uses: pre-commit-ci/[email protected] | ||
if: always() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,22 @@ | ||
# See https://pre-commit.com for more information | ||
# See https://pre-commit.com/hooks.html for more hooks | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v3.2.0 | ||
hooks: | ||
- id: detect-private-key | ||
- repo: https://github.com/compilerla/conventional-pre-commit | ||
rev: 'v2.3.0' | ||
hooks: | ||
- id: conventional-pre-commit | ||
stages: [commit-msg] | ||
args: ['feat', 'fix', 'ci', 'chore', 'test', 'docs', 'refactor'] | ||
- repo: https://github.com/tekwizely/pre-commit-golang | ||
rev: 'v1.0.0-rc.1' | ||
hooks: | ||
- id: go-mod-tidy | ||
- id: go-vet-mod | ||
- id: go-fmt | ||
- id: go-staticcheck-mod | ||
- id: go-sec-mod | ||
- id: go-build-mod | ||
- id: go-test-mod | ||
- id: go-sec-mod | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v3.2.0 | ||
hooks: | ||
- id: detect-private-key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,28 @@ | ||
#!/usr/bin/env bash | ||
|
||
command_exists() { | ||
command -v "$1" >/dev/null 2>&1 | ||
} | ||
|
||
BEARER_TOKEN=$(curl -s https://hubject.stoplight.io/api/v1/projects/cHJqOjk0NTg5/nodes/6bb8b3bc79c2e-authorization-token | jq -r .data | sed -n '/Bearer/s/^.*Bearer //p') | ||
|
||
# fall back to BEARER_TOKEN if no arg | ||
CSO_OPCP_TOKEN="${1:-$BEARER_TOKEN}" | ||
MO_OPCP_TOKEN="${2:-$BEARER_TOKEN}" | ||
|
||
export MO_OPCP_TOKEN=$MO_OPCP_TOKEN; export CSO_OPCP_TOKEN=$CSO_OPCP_TOKEN;docker-compose up "${@:2}" --build | ||
shift | ||
|
||
# Check if 'docker compose' is available (with space) | ||
if command_exists "docker compose"; then | ||
DOCKER_COMPOSE_CMD="docker compose" | ||
else | ||
# Check if 'docker-compose' is available | ||
if command_exists docker-compose; then | ||
DOCKER_COMPOSE_CMD="docker-compose" | ||
else | ||
echo "Error: Neither 'docker-compose' nor 'docker compose' is available. Please install Docker Compose." | ||
exit 1 | ||
fi | ||
fi | ||
|
||
export MO_OPCP_TOKEN=$MO_OPCP_TOKEN; export CSO_OPCP_TOKEN=$CSO_OPCP_TOKEN;$DOCKER_COMPOSE_CMD up "${@:2}" |