helm-docs
helm-docs copied to clipboard
pre-commit hook in GitHub Action
Hey and thanks for this tool, it makes my life easier :)
I was wondering how I can use the pre-commit hook with a GitHub action? If I use the official GitHub action for pre-commit and install helm-docs like this, it fails with Please install helm-docs to run the pre-commit hook! https://github.com/norwoodj/helm-docs#installation:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v1
with:
go-version: '1.16.4'
- name: Install helm-docs
run: GO111MODULE=on go get github.com/norwoodj/helm-docs/cmd/helm-docs
- run: helm docs
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: pre-commit/[email protected]
Is this due to the pre-commit action being run in its own container, can you maybe help me out here?
Here's how my github action looks like, hopefully helps!
name: Update docs
on:
push:
branches:
- main
jobs:
update-readme:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run helm-docs
run: |
GOBIN=$PWD GO111MODULE=on go get github.com/norwoodj/helm-docs/cmd/helm-docs
./helm-docs --sort-values-order file
rm helm-docs
- name: Commit bump
uses: EndBug/add-and-commit@v7
with:
branch: ${{ github.event.pull_request.base.ref }}
message: 'Regenerate chart README.md'
@macobo this doesn't work any more
@maxisam check out https://github.com/morremeyer/charts/blob/1badbd9a894fa292c3b4bceadbe8a1f6f7b7e35a/.github/workflows/helm-docs.yml for a working config.
I'll close this since the underlying question I had is resolved.
I ended up having to install helm-docs from source locally, because using the homebrew version appends two extra lines at the bottom (autogenerated using ...) which then caused the CI pipeline to fail git diff --exit-code. It would be nice to have an option to disable this message!