-
Notifications
You must be signed in to change notification settings - Fork 4
73 lines (70 loc) · 2.44 KB
/
test.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
name: Test
on: push
jobs:
test_plan_approval:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Submit plan
# Normally, this would be `uses: jbergknoff/github-action-wait-for-terraform-plan-approval@v1`
uses: ./
id: submit_plan
with:
command: submit
plan_contents: Hello, world!
- name: Wait while plan is ignored
uses: ./
id: first_wait
continue-on-error: true
with:
command: wait
plan_id: ${{steps.submit_plan.outputs.plan_id}}
timeout_seconds: 10
- name: Verify wait timed out
if: steps.first_wait.outputs.plan_status != 'timed out' || steps.first_wait.outcome != 'failure'
run: echo "Action should have reported timeout and exited 1, but did not"; exit 1
- name: Approve plan
run: |-
curl -X PUT -d '{"status": "approved"}' -H 'content-type: application/json' "${{steps.submit_plan.outputs.approval_prompt_url}}"/status
- name: Wait after plan is approved
uses: ./
id: second_wait
with:
command: wait
plan_id: ${{steps.submit_plan.outputs.plan_id}}
timeout_seconds: 10
test_plan_rejection:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Submit plan
uses: ./
id: submit_plan
with:
command: submit
plan_contents: Hello, world!
- name: Wait while plan is ignored
uses: ./
id: first_wait
continue-on-error: true
with:
command: wait
plan_id: ${{steps.submit_plan.outputs.plan_id}}
timeout_seconds: 10
- name: Verify wait timed out
if: steps.first_wait.outputs.plan_status != 'timed out' || steps.first_wait.outcome != 'failure'
run: echo "Action should have reported timeout and exited 1, but did not"; exit 1
- name: Reject plan
run: |-
curl -X PUT -d '{"status": "rejected"}' -H 'content-type: application/json' "${{steps.submit_plan.outputs.approval_prompt_url}}"/status
- name: Wait after plan is rejected
uses: ./
id: second_wait
continue-on-error: true
with:
command: wait
plan_id: ${{steps.submit_plan.outputs.plan_id}}
timeout_seconds: 10
- name: Verify plan was rejected
if: steps.second_wait.outputs.plan_status != 'rejected' || steps.second_wait.outcome != 'failure'
run: echo "Action should have reported rejection and exited 1, but did not"; exit 1