Skip to content

Commit 4684ca9

Browse files
committed
feat(helm): add action to generate chart documentation
Signed-off-by: Emilien Escalle <emilien.escalle@escemi.com>
1 parent 7645aea commit 4684ca9

5 files changed

Lines changed: 100 additions & 0 deletions

File tree

.github/workflows/__shared-ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ jobs:
4242
needs: linter
4343
uses: ./.github/workflows/__test-action-get-image-name.yml
4444

45+
test-action-helm-generate-docs:
46+
needs: linter
47+
uses: ./.github/workflows/__test-action-helm-generate-docs.yml
48+
4549
test-action-helm-parse-chart-uri:
4650
needs: linter
4751
uses: ./.github/workflows/__test-action-helm-parse-chart-uri.yml
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
name: Test for "helm/generate-docs" action
3+
run-name: Test for "helm/generate-docs" action
4+
5+
on: # yamllint disable-line rule:truthy
6+
workflow_call:
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
12+
jobs:
13+
tests:
14+
name: Test for "helm/generate-docs" action
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
18+
19+
- id: generate-docs
20+
uses: ./actions/helm/generate-docs
21+
with:
22+
working-directory: ./test-chart
23+
github-token: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ Opinionated GitHub Actions and workflows for continuous integration in container
2525

2626
### Helm
2727

28+
#### - [Generate chart documentation](actions/helm/generate-docs/README.md)
29+
2830
#### - [Parse chart URI](actions/helm/parse-chart-uri/README.md)
2931

3032
#### - [Release chart](actions/helm/release-chart/README.md)
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<!-- start title -->
2+
<!-- end title -->
3+
<!--
4+
// jscpd:ignore-start
5+
-->
6+
<!-- markdownlint-disable MD013 -->
7+
<!-- start badges -->
8+
<!-- end badges -->
9+
<!-- markdownlint-enable MD013 -->
10+
<!--
11+
// jscpd:ignore-end
12+
-->
13+
<!-- start description -->
14+
<!-- end description -->
15+
<!-- start contents -->
16+
<!-- end contents -->
17+
<!-- start usage -->
18+
<!-- end usage -->
19+
<!-- start inputs -->
20+
<!-- end inputs -->
21+
<!-- start outputs -->
22+
<!-- end outputs -->
23+
<!-- start [.github/ghadocs/examples/] -->
24+
<!-- end [.github/ghadocs/examples/] -->
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
name: "Helm - Generate Chart Documentation"
3+
description: |
4+
Action to generate documentation for a Helm chart.
5+
It will generate the documentation in the `docs/` directory of the chart.
6+
Mainly using [losisin/helm-docs-github-action](https://github.com/losisin/helm-docs-github-action).
7+
author: Hoverkraft
8+
branding:
9+
icon: book-open
10+
color: blue
11+
12+
inputs:
13+
working-directory:
14+
description: "Working directory"
15+
required: false
16+
default: "${{ github.workspace }}"
17+
github-token:
18+
description: |
19+
GitHub Token to create and merge pull request.
20+
Permissions:
21+
- contents: write
22+
- pull-requests: write
23+
default: ${{ github.token }}
24+
runs:
25+
using: "composite"
26+
steps:
27+
- shell: bash
28+
id: prepare-variables
29+
run: |
30+
echo "working-directory-name=$(basename "${{ inputs.working-directory }}")" >> "$GITHUB_OUTPUT"
31+
32+
- uses: hoverkraft-tech/ci-github-common/actions/checkout@9a3d71ca9f68bc1061db8ea1442084ac31a0f8bf # 0.23.0
33+
34+
- uses: losisin/helm-docs-github-action@8dc2304e986afbbb0b7db0a9980b6bf68c1307cf # v1.5.2
35+
with:
36+
chart-search-root: ${{ inputs.working-directory }}
37+
38+
- uses: hoverkraft-tech/ci-github-common/actions/create-and-merge-pull-request@9a3d71ca9f68bc1061db8ea1442084ac31a0f8bf # 0.23.0
39+
with:
40+
github-token: ${{ input.github-token }}
41+
branch: docs/update-helm-chart-docs-${{ steps.prepare-variables.outputs.working-directory-name }}
42+
title: "docs: update Helm chart documentation for ${{ steps.prepare-variables.outputs.working-directory-name }}"
43+
body: Clean review apps of ${{ github.event.client_payload.repository }}
44+
commit-message: |
45+
docs: update Helm chart documentation for ${{ steps.prepare-variables.outputs.working-directory-name }}
46+
47+
[skip ci]

0 commit comments

Comments
 (0)