Skip to content

OCM-23911 | chore: add coderabbit configuration file #21

OCM-23911 | chore: add coderabbit configuration file

OCM-23911 | chore: add coderabbit configuration file #21

name: Generate terraform docs
on:
pull_request:
branches:
- main
types: [opened, synchronize, reopened]
jobs:
docs:
# Mintmaker / Konflux dependency update PRs
if: startsWith(github.head_ref, 'konflux/mintmaker/')
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/create-github-app-token@v3.1.1
id: app-token
with:
client-id: ${{ vars.REDHAT_GITHUB_APP_CLIENT_ID }}
private-key: ${{ secrets.REDHAT_GITHUB_APP_PRIVATE_KEY }}
permission-contents: write
- name: Checkout
uses: actions/checkout@v6.0.2
with:
# Installation token (not GITHUB_TOKEN) so git operations are as the GitHub App
token: ${{ steps.app-token.outputs.token }}
ref: ${{ github.head_ref }}
- name: Install terraform-docs
run: |
set -euo pipefail
TERRAFORM_DOCS_VERSION="$(grep -E '^ARG TERRAFORM_DOCS_VERSION=' Dockerfile | cut -d= -f2)"
curl -sSLo ./terraform-docs.tar.gz "https://terraform-docs.io/dl/v${TERRAFORM_DOCS_VERSION}/terraform-docs-v${TERRAFORM_DOCS_VERSION}-linux-amd64.tar.gz"
tar -xzf terraform-docs.tar.gz terraform-docs
chmod +x terraform-docs
sudo mv terraform-docs /usr/local/bin/terraform-docs
rm -f terraform-docs.tar.gz
terraform-docs version
# Commits are created via the GitHub Git Database API (not git commit) so GitHub can
# attribute and verify them for the authenticated GitHub App installation.
- name: Render terraform docs and push changes
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
REPOSITORY: ${{ github.repository }}
BRANCH: ${{ github.head_ref }}
COMMIT_MESSAGE: "OCM-00000 | docs: update terraform-docs after deps bump"
run: |
set -euo pipefail
make terraform-docs
files=()
while IFS= read -r -d '' f; do files+=("$f"); done < <(git ls-files -z -m -o --exclude-standard)
if [ "${#files[@]}" -eq 0 ]; then
echo "No terraform-docs changes to commit."
exit 0
fi
bash scripts/github-app-single-commit.sh "${files[@]}"