Skip to content

Commit 60e4548

Browse files
committed
added trigger by comment and random deployment_name
1 parent 5270dd4 commit 60e4548

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

.github/workflows/terraform-plan.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on:
44
pull_request:
55
branches:
66
- main
7+
issue_comment:
8+
types: [edited, created]
79

810
permissions:
911
contents: read
@@ -12,6 +14,10 @@ jobs:
1214
terraform:
1315
name: 'Terraform Plan'
1416
runs-on: self-hosted
17+
if: |
18+
github.event.issue.pull_request &&
19+
(contains(github.event.comment.body, '/terraform_plan') ||
20+
contains(github.event.comment.body, '/terraform_apply'))
1521
1622
steps:
1723
# Checkout the repository to the GitHub Actions runner
@@ -51,5 +57,5 @@ jobs:
5157
TF_VAR_timezone: ${{ vars.TIMEZONE }}
5258
TF_VAR_ssh_access_source_ranges: ${{ vars.SSH_ACCESS_SOURCE_RANGES }}
5359
TF_VAR_ui_access_source_ranges: ${{ vars.UI_ACCESS_SOURCE_RANGES }}
54-
TF_VAR_deployment_name: ${{ vars.DEPLOYMENT_NAME }}
60+
TF_VAR_deployment_name: "github-${{ github.event.pull_request.number }}-${{ github.run_id }}"
5561
TF_VAR_instance_name: ${{ vars.INSTANCE_NAME }}

0 commit comments

Comments
 (0)