Skip to content

Commit 94589cd

Browse files
committed
fix(ci): apply 시 커밋 SHA 필수 입력 + ref 기반 checkout
- workflow_dispatch에 ref 입력 추가 - apply는 ref 공란이면 실행 차단 - plan은 ref 선택 (공란 시 현재 브랜치)
1 parent 4978ff2 commit 94589cd

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

.github/workflows/terraform-v3-k8s.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ on:
1313
options:
1414
- plan
1515
- apply
16+
ref:
17+
description: "체크아웃할 커밋 SHA (apply 시 필수, plan은 선택)"
18+
required: false
19+
type: string
1620

1721
concurrency:
1822
group: terraform-v3-k8s-dev
@@ -39,6 +43,8 @@ jobs:
3943
plan_exitcode: ${{ steps.plan.outputs.exitcode }}
4044
steps:
4145
- uses: actions/checkout@v4
46+
with:
47+
ref: ${{ inputs.ref || '' }}
4248

4349
- uses: aws-actions/configure-aws-credentials@v4
4450
with:
@@ -131,10 +137,16 @@ jobs:
131137
apply:
132138
name: "Terraform Apply"
133139
needs: plan
134-
if: github.event_name == 'workflow_dispatch' && github.event.inputs.action == 'apply' && needs.plan.outputs.plan_exitcode == '2'
140+
if: >-
141+
github.event_name == 'workflow_dispatch' &&
142+
github.event.inputs.action == 'apply' &&
143+
github.event.inputs.ref != '' &&
144+
needs.plan.outputs.plan_exitcode == '2'
135145
runs-on: ubuntu-latest
136146
steps:
137147
- uses: actions/checkout@v4
148+
with:
149+
ref: ${{ inputs.ref }}
138150

139151
- uses: aws-actions/configure-aws-credentials@v4
140152
with:

0 commit comments

Comments
 (0)