Skip to content

add in terraform actions #13

add in terraform actions

add in terraform actions #13

Workflow file for this run

name: tfsec
on:
push:
branches:
- main
pull_request:
jobs:
tfsec:
name: tfsec
runs-on: ubuntu-latest
steps:
- name: Clone repo
uses: actions/checkout@v4
- name: Run tfsec
id: tfsec
uses: aquasecurity/[email protected]
with:
soft_fail: true
- name: Extract tfsec results
id: extract
run: |
results=$(grep -A 6 "results" tfsec_output.txt | tail -n 6)
echo "TFSEC_RESULTS<<EOF" >> $GITHUB_ENV
echo "$results" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Post tfsec summary as PR comment
if: ${{ github.event_name == 'pull_request' }}
uses: actions/github-script@v6
with:
script: |
const { issue, repo } = github.context;
const comment = `
## tfsec Scan Summary
\`\`\`
${process.env.TFSEC_RESULTS}
\`\`\`
`;
github.rest.issues.createComment({
issue_number: issue.number,
owner: repo.owner,
repo: repo.repo,
body: comment,
});