Skip to content

Commit

Permalink
Update ci.yml
Browse files Browse the repository at this point in the history
Eureka?
  • Loading branch information
AdmiraalA committed Apr 2, 2024
1 parent 0580abf commit b65e8d7
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ jobs:
directory: ${{ env.CONFIG_DIRECTORY }}
speculative: true

- name: Initialize Terraform Backend
run: terraform init -reconfigure
env:
TF_CLOUD_ORGANIZATION: ${{ env.TF_CLOUD_ORGANIZATION }}
TF_API_TOKEN: ${{ env.TF_API_TOKEN }}
TF_WORKSPACE: ${{ env.TF_WORKSPACE }}

- name: Create Plan Run
uses: hashicorp/tfc-workflows-github/actions/[email protected]
id: plan-run
Expand Down Expand Up @@ -59,14 +66,22 @@ jobs:
*Pushed by: @${{ github.actor }}, Action: \`${{ github.event_name }}\`*`;
if (context.payload.pull_request) {
await github.rest.issues.createComment({
issue_number: context.payload.pull_request.number,
await github.rest.issues.updateComment({
comment_id: context.payload.pull_request.issue_url.split('/').pop(),
owner: context.repo.owner,
repo: context.repo.repo,
body: output
});
} else {
console.log('No pull request context found.');
const response = await github.rest.pulls.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: 'Automated Pull Request',
head: '${{ github.actor }}:main',
base: 'main',
body: output
});
console.log('Pull request created:', response.data.html_url);
}
- name: Terraform Plan Status
Expand Down

0 comments on commit b65e8d7

Please sign in to comment.