feat: check plan diff for staleness before applying in merge queue #172
Workflow file for this run
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: TF Tests | |
on: | |
pull_request: | |
paths: [.github/workflows/tf_tests.yaml, tests/**, action.*] | |
types: [opened, reopened, synchronize, closed] | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
permissions: | |
actions: read # Required to download repository artifact. | |
checks: write # Required to add status summary. | |
contents: read # Required to checkout repository. | |
pull-requests: write # Required to add PR comment and label. | |
strategy: | |
fail-fast: false | |
matrix: | |
tool: [tofu, terraform] | |
path: | |
- fail_invalid_resource_type | |
- fail_data_source_error | |
- pass_one | |
- pass_character_limit | |
- pass_format_diff | |
steps: | |
- name: Echo github | |
env: | |
GH_JSON: ${{ toJson(github) }} | |
run: echo "$GH_JSON" | |
- name: Echo context | |
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 | |
with: | |
script: console.log(JSON.stringify(context, null, 2)) | |
- name: Checkout repository | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- name: Provision TF | |
id: tf | |
continue-on-error: true | |
uses: ./ | |
with: | |
arg_chdir: tests/${{ matrix.path }} | |
arg_command: apply # ${{ github.event.pull_request.merged && 'apply' || 'plan' }} | |
arg_lock: ${{ github.event.pull_request.merged && 'true' || 'false' }} | |
tf_tool: ${{ matrix.tool }} | |
tf_version: ~> 1.8.0 | |
plan_parity: true | |
- name: Echo TF | |
run: | | |
echo "check_id: ${{ steps.tf.outputs.check_id }}" | |
echo "comment_id: ${{ steps.tf.outputs.comment_id }}" | |
echo "fmt_result: ${{ steps.tf.outputs.fmt_result }}" | |
echo "header: ${{ steps.tf.outputs.header }}" | |
echo "identifier: ${{ steps.tf.outputs.identifier }}" | |
echo "last_result: ${{ steps.tf.outputs.last_result }}" | |
echo "outline: ${{ steps.tf.outputs.outline }}" | |
echo "summary: ${{ steps.tf.outputs.summary }}" |