Skip to content

Commit

Permalink
Use python ... in python script
Browse files Browse the repository at this point in the history
Signed-off-by: Alexandre Nicolaie <alexandre.nicolaie@gmail.com>
  • Loading branch information
xunleii committed Nov 11, 2023
1 parent b8c94d1 commit 697de2e
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions .github/workflows/templates.terraform.pull_requests.plan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,25 +51,26 @@ jobs:
- name: Pre-hook Terraform workflow
id: pre
run: |
import os
import yaml
# Setup `workdir` suffix used to give more information during execution
if [[ '${{ inputs.terraform_workdir }}' == '.' ]]; then
echo "workdir=" >> "${GITHUB_OUTPUT}"
else
echo "workdir=(${{ inputs.terraform_workdir }})" >> "${GITHUB_OUTPUT}"
fi
if [[ '${{ inputs.after_lint }}' == 'true' ]]; then
echo 'lint_fmt_success="- [x] :paintbrush: Check if all Terraform configuration files are in a canonical format"' >> "${GITHUB_OUTPUT}"
echo 'lint_val_success="- [x] :hammer_and_wrench: Validate the configuration files"' >> "${GITHUB_OUTPUT}"
else
echo 'lint_fmt_success=""' >> "${GITHUB_OUTPUT}"
echo 'lint_val_success=""' >> "${GITHUB_OUTPUT}"
fi
# Import Terraform variables
import yaml
import os
with open(os.getenv('GITHUB_OUTPUT'), 'a') as output:
if inputs.terraform_workdir == '.':
output.write('workdir=\n')
else:
output.write('workdir=(${{ inputs.terraform_workdir }})\n')
if inputs.after_lint == 'true':
output.write('- [x] :paintbrush: Check if all Terraform configuration files are in a canonical format\n')
output.write('- [x] :hammer_and_wrench: Validate the configuration files\n')
else:
output.write('lint_fmt_success=""\n')
output.write('lint_val_success=""\n')
# Import Terraform variables
tf_env = '''
${{ inputs.env }}
${{ secrets.env }}
Expand Down

0 comments on commit 697de2e

Please sign in to comment.