Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ permissions:

jobs:
github-action:
uses: cloudposse/.github/.github/workflows/shared-release-branches.yml@main
uses: cloudposse-github-actions/.github/.github/workflows/shared-release-branches.yml@main
secrets: inherit
52 changes: 50 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ inputs:
description: "The title to use when creating a Pull Request (when commit_method: pr)"

pr_labels:
description: "Whitespace-separated list of labels to apply to Pull Requests (when commit_method: pr)"
description: "Whitespace-separated list of labels to apply to Pull Requests (when commit_method: pr or ( commit_method: commit and github context is a PR) )"
required: false
default: |
auto-update
Expand All @@ -99,6 +99,9 @@ outputs:
readme_file:
description: "Generated README file path (if readme_enabled: true)"
value: "${{ steps.readme.outputs.file }}"
changes_detected:
description: "Changes detected"
value: "${{ steps.auto-commit.outputs.changes_detected || steps.auto-pr.outputs.pull-request-number != false }}"

runs:
using: "composite"
Expand Down Expand Up @@ -225,6 +228,38 @@ runs:
fi
echo "file=README.md" >> $GITHUB_OUTPUT

- name: "Install terraform-docs"
uses: jaxxstorm/[email protected]
with:
repo: terraform-docs/terraform-docs
tag: v0.19.0
cache: enable

- id: rebuild-submodules
if: inputs.readme_enabled == 'true'
shell: bash
run: |
terraform-docs markdown ./src \
--output-file ../README.md \
--output-mode inject \
--output-template "<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->\n{{ .Content }}\n<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->"

dirs=($(find . -type d \( -name '.terraform*' -o -name 'obsolete*' \) -prune -o \
-name '*.tf' \
-not -path '*/.terraform/*' \
-exec dirname {} \; \
| sort \
| uniq ))

for module_dir in "${dirs[@]}"; do
if [[ -f ${module_dir}/README.md ]]; then
terraform-docs markdown ${module_dir} \
--output-file README.md \
--output-mode inject \
--output-template "<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->\n{{ .Content }}\n<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->"
fi
done

- uses: gaurav-nelson/github-action-markdown-link-check@v1
if: inputs.readme_enabled == 'true' && inputs.validate_readme == 'true'
with:
Expand All @@ -243,9 +278,21 @@ runs:
commit_user_name: "${{ inputs.commit_user_name }}"
commit_user_email: "${{ inputs.commit_user_email }}"
commit_author: "${{ inputs.commit_author }}"
file_pattern: '${{ steps.banner.outputs.file }} ${{ steps.readme.outputs.file }}'
file_pattern: '${{ steps.banner.outputs.file }} ${{ steps.readme.outputs.file }} **/README.md'
push_options: '${{ inputs.commit_push_options }}'

- uses: actions/github-script@v7
if: steps.auto-commit.outputs.changes_detected == 'true' && inputs.commit_method == 'commit' && github.event_name == 'pull_request'
with:
script: |
labels = '${{ inputs.pr_labels }}'.split(' ')
await github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: labels
})

- name: Add Image to Step Summary
if: steps.auto-commit.outputs.changes_detected == 'true' && inputs.banner_enabled == 'true' && inputs.commit_method == 'commit'
shell: bash
Expand All @@ -272,6 +319,7 @@ runs:
add-paths: |
${{ steps.banner.outputs.file }}
${{ steps.readme.outputs.file }}
**/README.md
docs/*

body: |-
Expand Down