Update github actions #8
Workflow file for this run
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
name: Pull request | |
on: | |
- pull_request | |
jobs: | |
collectInputs: | |
name: Collect workflow inputs | |
runs-on: ubuntu-latest | |
outputs: | |
directories: ${{ steps.dirs.outputs.matrix }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.ref }} | |
- name: Get root directories | |
id: dirs | |
run: echo "matrix=$(ls -d {modules,examples}/* | jq -R -s -c 'split("\n")[:-1]')" >> $GITHUB_OUTPUT | |
validateConfigs: | |
name: Validate terraform pull PR | |
needs: collectInputs | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
directory: ${{ fromJson(needs.collectInputs.outputs.directories) }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.ref }} | |
- name: Validate configs | |
uses: dflook/terraform-validate@v1 | |
with: | |
path: ${{ matrix.directory }} | |
updateDocumentation: | |
name: Update READMEs | |
needs: validateConfigs | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.ref }} | |
- name: Render terraform docs inside the README.md and push changes back to PR branch | |
uses: terraform-docs/[email protected] | |
with: | |
args: --recursive-include-main=false --read-comments=false | |
working-dir: modules,examples | |
recursive: true | |
recursive-path: . | |
output-file: README.md | |
output-method: inject | |
git-push: "true" | |