Added support for basic authentication (#4) #31
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |