Skip to content

Commit

Permalink
ci: Add mock functions
Browse files Browse the repository at this point in the history
  • Loading branch information
staticaland authored Nov 20, 2023
1 parent babcd9d commit ab14c76
Showing 1 changed file with 32 additions and 2 deletions.
34 changes: 32 additions & 2 deletions .github/workflows/run_ok_command.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,37 @@ jobs:
go-version-file: "go.mod"
cache-dependency-path: "go.sum"


- name: Install ok
- Setup mocks
run: |
function setupMocks() {
if ! command -v terraform &> /dev/null; then
function terraform() {
printf "mock terraform with args: %s\n" "${ARRAY_VAR[@]}"
}
export -f terraform
else
_ORIGINAL_TERRAFORM=$(which terraform)
fi
if ! command -v fzf &> /dev/null; then
function fzf() {
printf "mock fzf with args: %s\n" "${ARRAY_VAR[@]}"
}
export -f fzf
else
_ORIGINAL_FZF=$(which fzf)
fi
if ! command -v gh &> /dev/null; then
function gh() {
printf "mock gh with args: %s\n" "${ARRAY_VAR[@]}"
}
export -f gh
else
_ORIGINAL_GH=$(which gh)
fi
- name: Run ok
run: |
setupMocks
go run main.go "${{ inputs.subcommand }}"

0 comments on commit ab14c76

Please sign in to comment.