Skip to content

Commit 8268c7c

Browse files
committed
update step to finetune kubeconfig setting
1 parent 7a42cdb commit 8268c7c

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

action.yaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,16 +88,25 @@ runs:
8888
- name: Create kubeconfig file
8989
if: ${{ inputs.kubeconfig != '' }}
9090
run: |
91+
echo "Processing kubeconfig input..."
9192
mkdir -p ~/.kube
9293
if [[ "${{ inputs.kubeconfig }}" =~ ^(/|~|\.)/.*(\.yaml|\.yml|\.config)$ ]]; then
94+
echo "Input appears to be a file path: ${{ inputs.kubeconfig }}"
9395
# If input is a file path, copy it only if it's different from target
94-
if [[ "${{ inputs.kubeconfig }}" != "$HOME/.kube/config" ]]; then
96+
input_path=$(realpath -m "${{ inputs.kubeconfig }}")
97+
target_path=$(realpath -m ~/.kube/config)
98+
if [[ "$input_path" != "$target_path" ]]; then
99+
echo "Copying kubeconfig from $input_path to $target_path"
95100
cp "${{ inputs.kubeconfig }}" ~/.kube/config
101+
else
102+
echo "Input path matches target path, skipping copy"
96103
fi
97104
else
105+
echo "Input appears to be direct kubeconfig content, writing to ~/.kube/config"
98106
# If input is the actual kubeconfig content, write it
99107
echo -e "${{ inputs.kubeconfig }}" > ~/.kube/config
100108
fi
109+
echo "Kubeconfig setup complete"
101110
shell: bash
102111

103112
- name: Set namespace

0 commit comments

Comments
 (0)