Skip to content

chore: disable terraform-docs push when on forks and sign commit #28

chore: disable terraform-docs push when on forks and sign commit

chore: disable terraform-docs push when on forks and sign commit #28

Workflow file for this run

name: ci
on:
- pull_request
jobs:
ci:
runs-on: ubuntu-latest
permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the
# added or changed files to the repository.
contents: write
steps:
# Setup dependencies
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
# Run a couple of native Terraform checks
- uses: hashicorp/setup-terraform@v3
- run: terraform init
- run: terraform fmt -recursive -check
- run: terraform validate
# Checkov
- uses: bridgecrewio/checkov-action@v12
with:
directory: .
quiet: true
skip_check: CKV_TF_1,CKV_GCP_32,CKV_GCP_34,CKV2_GCP_18
framework: terraform
# Terraform-docs
- uses: terraform-docs/gh-actions@v1.1.0
with:
working-dir: .
output-file: README.md
output-method: inject
fail-on-diff: true
args: --lockfile=false
git-push: 'false'
fail-on-diff: github.repository_owner != 'runatlantis' # Fail on diff for forks

Check failure on line 43 in .github/workflows/ci.yaml

View workflow run for this annotation

GitHub Actions / ci

Invalid workflow file

The workflow is not valid. .github/workflows/ci.yaml (Line: 43, Col: 11): 'fail-on-diff' is already defined
# Push Terraform-docs changes
- uses: stefanzweifel/git-auto-commit-action@v5
if: github.repository_owner == 'runatlantis' # skip for forks
with:
commit_message: "terraform-docs: automated action"
file_pattern: 'README.md'