Skip to content

Commit 7de60d2

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

6 files changed

Lines changed: 106 additions & 3 deletions

File tree

.github/workflows/__main-ci.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,17 @@ jobs:
5353
"test-build-args-secrets"
5454
]
5555
56+
helm-docs:
57+
needs: ci
58+
if: github.event_name != 'schedule'
59+
runs-on: ubuntu-latest
60+
steps:
61+
- uses: ./actions/helm/generate-docs
62+
with:
63+
working-directory: ./tests/charts
64+
github-app-id: ${{ vars.CI_BOT_APP_ID }}
65+
github-app-key: ${{ secrets.CI_BOT_APP_PRIVATE_KEY }}
66+
5667
release:
5768
needs: ci
5869
if: github.event_name != 'schedule'

.github/workflows/__pull-request-ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ on: # yamllint disable-line rule:truthy
88

99
permissions:
1010
actions: read
11-
contents: read
11+
contents: write
1212
issues: read
1313
packages: write
14-
pull-requests: read
14+
pull-requests: write
1515
security-events: write
1616
statuses: write
1717
# FIXME: This is a workaround for having workflow actions. See https://github.com/orgs/community/discussions/38659

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: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
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+
github-app-id:
25+
description: |
26+
GitHub App ID to generate GitHub token in place of github-token.
27+
See <https://github.com/actions/create-github-app-token>.
28+
required: false
29+
github-app-key:
30+
description: |
31+
GitHub App private key to generate GitHub token in place of github-token.
32+
See <https://github.com/actions/create-github-app-token>.
33+
required: false
34+
35+
runs:
36+
using: "composite"
37+
steps:
38+
- shell: bash
39+
id: prepare-variables
40+
run: |
41+
echo "working-directory-name=$(basename "${{ inputs.working-directory }}")" >> "$GITHUB_OUTPUT"
42+
43+
- uses: hoverkraft-tech/ci-github-common/actions/checkout@9a3d71ca9f68bc1061db8ea1442084ac31a0f8bf # 0.23.0
44+
45+
- uses: losisin/helm-docs-github-action@8dc2304e986afbbb0b7db0a9980b6bf68c1307cf # v1.5.2
46+
with:
47+
chart-search-root: ${{ inputs.working-directory }}
48+
49+
- uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
50+
if: inputs.github-app-id
51+
id: generate-token
52+
with:
53+
app-id: ${{ inputs.github-app-id }}
54+
private-key: ${{ inputs.github-app-key }}
55+
56+
- uses: hoverkraft-tech/ci-github-common/actions/create-and-merge-pull-request@9a3d71ca9f68bc1061db8ea1442084ac31a0f8bf # 0.23.0
57+
with:
58+
github-token: ${{ steps.generate-token.outputs.token || inputs.github-token }}
59+
branch: docs/update-helm-chart-docs-${{ steps.prepare-variables.outputs.working-directory-name }}
60+
title: "docs: update Helm chart documentation for ${{ steps.prepare-variables.outputs.working-directory-name }}"
61+
body: |
62+
This pull request updates the documentation for the Helm chart `${{ steps.prepare-variables.outputs.working-directory-name }}`.
63+
commit-message: |
64+
docs: update Helm chart documentation for ${{ steps.prepare-variables.outputs.working-directory-name }}
65+
66+
[skip ci]

actions/helm/parse-chart-uri/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ This action does not requires any permissions.
4444
4545
| **Input** | **Description** | **Default** | **Required** |
4646
| ---------------- | ------------------ | ----------- | ------------ |
47-
| <code>uri</code> | Chart URI to parse | | **true** |
47+
| <code>URI</code> | Chart URI to parse | | **true** |
4848
4949
<!-- end inputs -->
5050
<!-- start outputs -->

0 commit comments

Comments
 (0)