Skip to content

Conversation

exaucae
Copy link

@exaucae exaucae commented Dec 19, 2023

fixes #63 with the least amount of changes by leveraging -S option of git commit.

I use it like so (focus on last step):

name: Generate terraform docs
on:
  workflow_dispatch:
  pull_request:

jobs:
  generate-docs:
    permissions:
      contents: write
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3
        with:
          fetch-depth: 0
          ref: ${{ github.event.pull_request.head.ref }}
          repository: ${{ github.event.pull_request.head.repo.full_name }}
      - name: get target modules
        run: |
          echo "TARGET_MODULES=$(ls -dm -- terraform/*/ | xargs)" >>${GITHUB_ENV}
      - name: Import GPG key
        id: import-gpg
        uses: crazy-max/ghaction-import-gpg@v4
        with:
          gpg_private_key: ${{ secrets.GT_BOT_GPG_PRIVATE_KEY }}
          passphrase: ${{ secrets.GT_BOT_GPG_PASSPHRASE }}
          git_user_signingkey: true
          git_commit_gpgsign: true
          git_config_global: true
      - name: Render terraform docs and push changes back to PR
        uses: terraform-docs/[email protected]
        with:
          working-dir: ${{ env.TARGET_MODULES }}
          config-file: terraform/.terraform-docs.yml
          output-method: replace
          git-push: "true"
          git-commit-gpg-sign: "true"    #  <--------- gpg verification activated
          git-commit-message: "docs(terraform): autogenerate docs"
          git-push-user-email: ${{ steps.import-gpg.outputs.email }}
          git-push-user-name: ${{ steps.import-gpg.outputs.name }}









Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enable Verified Commits (with GPG key as secret)
2 participants