Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
aquasecurity

GitHub Action

Run tfsec PR commenter

v1.0.4

Run tfsec PR commenter

aquasecurity

Run tfsec PR commenter

Runs tfsec and adds comments to the PR where checks have failed

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Run tfsec PR commenter

uses: aquasecurity/tfsec-pr-commenter-action@v1.0.4

Learn more about this action in aquasecurity/tfsec-pr-commenter-action

Choose a version

tfsec-pr-commenter-action

Add comments to pull requests where tfsec checks have failed

To add the action, add tfsec_pr_commenter.yml into the .github/workflows directory in the root of your Github project.

The contents of tfsec_pr_commenter.yml should be;

name: tfsec-pr-commenter
on:
  pull_request:
jobs:
  tfsec:
    name: tfsec PR commenter
    runs-on: ubuntu-latest

    steps:
      - name: Clone repo
        uses: actions/checkout@master
      - name: tfsec
        uses: aquasecurity/tfsec-pr-commenter-action@v1.0.2
        with:
          github_token: ${{ github.token }}

On each pull request and subsequent commit, tfsec will run and add comments to the PR where tfsec has failed.

The comment will only be added once per transgression.

Optional inputs

There are a number of optional inputs that can be used in the with: block.

working_directory - the directory to scan in, defaults to ., ie current working directory

tfsec_version - the version of tfsec to use, defaults to latest

tfsec_vars - the args of the tfsec to use

commenter_version - the version of the commenter to use, defaults to latest

soft_fail_commenter - set to true to to comment silently without breaking the build

tfsec_vars

tfsec provides an extensive number of arguments which can be passed through as in the example below;

name: tfsec-pr-commenter
on:
  pull_request:
jobs:
  tfsec:
    name: tfsec PR commenter
    runs-on: ubuntu-latest

    steps:
      - name: Clone repo
        uses: actions/checkout@master
      - name: tfsec
        uses: aquasecurity/tfsec-pr-commenter-action@v1.0.2
        with:
          tfsec_vars: --soft-fail
          github_token: ${{ github.token }}

Example PR Comment

The screenshot below demonstrates the comments that can be expected when using the action

Example PR Comment