-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from dxw/allow-renovate-prs-to-commit-terrafor…
…m-docs Allow Renovate PRs to commit terraform-docs changes
- Loading branch information
Showing
1 changed file
with
28 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -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 }} |