Skip to content
This repository was archived by the owner on Mar 16, 2024. It is now read-only.

Commit 3466a34

Browse files
committed
Disable init by default if kubeconfig used
1 parent 480b645 commit 3466a34

File tree

5 files changed

+28
-8
lines changed

5 files changed

+28
-8
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,21 @@ jobs:
1515
npm install
1616
- run: |
1717
npm run all
18-
test: # make sure the action works on a clean machine without building
18+
k3s: # make sure the action works on a clean machine without building
1919
runs-on: ubuntu-latest
2020
steps:
2121
- uses: actions/checkout@v3
2222
- uses: ./
2323
- run: acorn
2424
shell: bash
25-
main:
25+
kubeconfig:
2626
runs-on: ubuntu-latest
2727
steps:
2828
- uses: actions/checkout@v3
2929
- uses: ./
3030
with:
31-
k3s-install: false
3231
kubeconfig: 'hello kube'
3332
acorn-version: main
34-
acorn-init: false
3533
- run: |
3634
env
3735
acorn

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ inputs:
1212
acorn-init:
1313
description: Whether to initialize acorn in the cluster
1414
required: false
15-
default: 'true'
15+
default: 'auto'
1616

1717
kubeconfig:
1818
description: Provide a kubeconfig to use instead of installing k3s

dist/index.js

Lines changed: 12 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@ import {resolve} from 'path'
77
async function setup(): Promise<void> {
88
const kubeconfig = core.getInput('kubeconfig')
99

10+
const initStr = core.getInput('acorn-init')
11+
let init = false
12+
13+
if (initStr === 'auto') {
14+
init = !kubeconfig
15+
} else {
16+
init = core.getBooleanInput('acorn-init')
17+
}
18+
1019
if (kubeconfig) {
1120
core.info(`Applying kubeconfig`)
1221

@@ -35,9 +44,11 @@ async function setup(): Promise<void> {
3544
core.info('Installing acorn')
3645
await acorn.installAsset(asset)
3746

38-
if (core.getBooleanInput('acorn-init')) {
47+
if (init) {
3948
core.info('Initializing acorn on cluster')
4049
await acorn.init()
50+
} else {
51+
core.info('Skipping acorn init')
4152
}
4253
}
4354

0 commit comments

Comments
 (0)