-
-
Notifications
You must be signed in to change notification settings - Fork 10
/
tf_via_pr_comments_or_input.yaml
41 lines (36 loc) · 1.45 KB
/
tf_via_pr_comments_or_input.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
---
name: TF via PR Comments or Input
on:
issue_comment:
types: [created, edited]
pull_request:
types: [opened, reopened, synchronize, closed]
paths: ['**/*.tf*']
jobs:
tf:
runs-on: ubuntu-latest
if: startsWith(github.event.comment.body, '-tf=') || github.event.action != 'closed' || github.event.pull_request.merged
permissions:
actions: read # Required for workflow query and artifact download.
checks: write # Required for adding summary to check status.
contents: read # Required for repository checkout.
issues: read # Required for getting PR branch from issue comment.
pull-requests: write # Required for commenting on PR.
statuses: write # Required for setting commit status from issue comment.
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.issue && format('refs/pull/{0}/merge', github.event.issue.number) }}
- name: Setup TF
uses: hashicorp/setup-terraform@v3
- name: Provision TF
uses: devsectop/tf-via-pr-comments@v10
env:
TF_VAR_PLACEHOLDER: value
with:
recreate_comment: true
var_file_from_workspace: true
command_input: ${{ github.event.comment && '' || format('-tf={0} -chdir=sample/sample_instance -workspace=dev', github.event.action != 'closed' && 'plan' || 'apply') }}
var_file_prefix: env/
var_file_suffix: .tfvars