-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2c09b96
commit 79c93b7
Showing
1 changed file
with
18 additions
and
10 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,8 @@ name: terraform | |
|
||
on: | ||
- pull_request | ||
|
||
env: | ||
working_directory: ./test | ||
jobs: | ||
terraform: | ||
runs-on: ubuntu-latest | ||
|
@@ -13,14 +14,15 @@ jobs: | |
|
||
- name: Terraform Init | ||
id: init | ||
run: terraform init | ||
working-directory: ./test | ||
run: terraform init && | ||
echo ${{env.working_directory}} | ||
working-directory: env.working_directory | ||
|
||
- name: Terraform Plan | ||
id: plan | ||
run: terraform plan -no-color | ||
continue-on-error: true | ||
working-directory: ./test | ||
working-directory: env.working_directory | ||
|
||
- uses: actions/[email protected] | ||
if: github.event_name == 'pull_request' | ||
|
@@ -29,22 +31,28 @@ jobs: | |
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
const output = `#### Terraform Format and Style 🖌\`${{ steps.fmt.outcome }}\` | ||
#### Terraform Initialization ⚙️\`${{ steps.init.outcome }}\` | ||
#### Terraform Validation 🤖${{ steps.validate.outputs.stdout }} | ||
#### Terraform Plan 📖\`${{ steps.plan.outcome }}\` | ||
const tfInitStatus = ${{steps.init.outputs.exitcode == 0}} ? ':x:' : ':white_check_mark:' | ||
const tfValidationStatus = ${{steps.validate.outputs.exitcode == 0}} ? ':x:' : ':white_check_mark:' | ||
const tfPlanStatus = ${{steps.plan.outputs.exitcode == 0}} ? ':x:' : ':white_check_mark:' | ||
const output = `${tfInitStatus} Terraform Initialization | ||
${tfValidationStatus} Terraform Validation | ||
${tfPlanStatus} Terraform Plan | ||
<details><summary>Show Plan</summary> | ||
\`\`\`${process.env.PLAN}\`\`\` | ||
</details> | ||
*Pusher: @${{ github.actor }}, Action: \`${{ github.event_name }}\`, Working Directory: \`${{ env.tf_actions_working_dir }}\`, Workflow: \`${{ github.workflow }}\`*`; | ||
*User*: @${{ github.actor }} | ||
*Action*: \`${{ github.event_name }}\` | ||
*Working Directory*: \`${{ env.working_directory }}\` | ||
*Workflow*: \`${{ github.workflow }}\``; | ||
github.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: output | ||
}) | ||
}) |