Skip to content

Commit

Permalink
Merge pull request #15 from dxw/allow-renovate-prs-to-commit-terrafor…
Browse files Browse the repository at this point in the history
…m-docs

Allow Renovate PRs to commit terraform-docs changes
  • Loading branch information
Stretch96 authored Oct 17, 2023
2 parents 3995cd0 + 9d380f1 commit d86f1e7
Showing 1 changed file with 28 additions and 2 deletions.
30 changes: 28 additions & 2 deletions .github/workflows/continuous-integration-terraform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@ on:
branches: main
pull_request:

env:
GITHUB_PR_BRANCH: ""

jobs:
terraform-validate:
name: Terraform Validate
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Get terraform version
id: get-terraform-version
Expand Down Expand Up @@ -56,15 +59,38 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
token: ${{ secrets.TERRAFORM_DOCS_RENOVATE_WORKFLOW_GITHUB_TOKEN }}

- name: Get PR base branch
id: pr-base-branch-name
if: github.event_name == 'pull_request'
run: |
echo "GITHUB_PR_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV
- name: Output PR base branch
run: |
echo "$GITHUB_PR_BRANCH"
- name: Generate Terraform docs
uses: terraform-docs/[email protected]
if: "!startsWith(env.GITHUB_PR_BRANCH, 'renovate/')"
with:
working-dir: .
config-file: .terraform-docs.yml
output-file: README.md
output-method: inject
fail-on-diff: true

- name: Generate Terraform docs for Renovate
uses: terraform-docs/[email protected]
if: "startsWith(env.GITHUB_PR_BRANCH, 'renovate/')"
with:
working-dir: .
config-file: .terraform-docs.yml
output-file: README.md
output-method: inject
git-push: true
ref: ${{ github.event.pull_request.head.ref }}

0 comments on commit d86f1e7

Please sign in to comment.